Translate

Mostrando entradas con la etiqueta IOS. Mostrar todas las entradas
Mostrando entradas con la etiqueta IOS. Mostrar todas las entradas

martes, 5 de marzo de 2013

IOS Popup Messages



You can create popup messages showing a title, a message, an a set of buttons. In my example the button "Clear Data" call this popup message to confirm the action. These are the steps needed to create the popup message:

1. Add to the interface of your header file.

2. Create the alert message with the following code:

UIAlertView *alert = [[UIAlertView alloc] initWithTitle:@"WARNING"
                                                                     message:@"All data wil be erased. Are you sure?"
                                                                     cancelButtonTiltle:@"Cancel",
                                                                     otherButtonTitles:@"Ok", nil ];
[alert show]
[alert release]  ------> if you have ARC enabled don´t use this line.


3. And finally you must use the following method  to control which button was pressed, and its associated action.


-(void)alertView:(UIAlertView *)alertView clickedButtonAtIndex:(NSInteger)buttonIndex







martes, 12 de febrero de 2013

Hidding a numeric keyboard in IOS

With the standart keyboard we have a "Done" button, so once the user click over this "Done" button the action "Did en on exit" is called. Then we can use the following piece of code to close the keyboard just when the users touch over this "Done" button:

       [self.theEditOutlet resignFirstResponder ]

But with the other numerical types of keyboardas this button doesn´t exist. In this case we could add a toollbar including a custom "Done" button, or more easilly using the method "touchesBegan".

This method must be implemented in the .m ViewController file and must be as follows:

-(void) touchesBegan:(NSSet  *)touches withEvent:(UIEvent *)event
{
    [self.theEditOutlet resignFirstresponder ]
}

miércoles, 6 de febrero de 2013

windows are expected to have a root view controller at the end of application launch

windows are expected to have a root view controller at the end of application launch

This is a warning that the compiler shows, so the application works. It is caused  because you have added a subview to a view without declaring the root View Controller first. To fix it you must replace:

[windows addSubview:self.aViewController.view];

for:

[windows setRootViewController:self.aViewController];