Skip to content

Some Xcode and iOS apps tips & tricks for beginners

How to disable word- / line-wrapping
Xcode Preferences (in the menu) -> Text Editing (in the top tabs) -> Indentation (that’s a clickable text in the top of the tab), in there you can check/uncheck Line wrapping

How to change iOS simulator language
You can simply use the Settings app in the simulator, just like on a normal device. Note that languages are shown in their own language, for instance “French” is “Français”, not “French”.

There is also an option that may be easier for switching back and forth between languages: you can run the app with a flag indicating the country, for instance add the flag -AppleLanguages (fr) for French.
This is explained more in details here:

Fixing some text getting automatically underlined in the app
This is cannot be changed by the app programmer as this is caused by a phone setting. So it’s up to the final user to disable it, in Settings -> General -> Accessibility, and then turning off Button Shapes.

Solving error “attempt to present UIAlertController on [some UI] whose view is not in the windows hierarchy”
I got this one while replacing the more robust UIAlertView with UIAlertController. The main PITA from UIAlertController is that you need to feed it the current view as an argument, unlike UIAlertView which apparently just guessed it. This blog post pointed me to the solution for my case. Basically, UIAlertController must be called on the currently visible view, not on some other view (even if it does exist but is not on display right now).

Little bonus: here is the function I use to display a network error alert every time needed:

+(void) networkErrorAlert:(id)sender
     UIAlertController* alert = [UIAlertController alertControllerWithTitle: NSLocalizedString(@"Error",@"")
                                                                    message: NSLocalizedString(@"No Internet Connection",@"")
                                                             preferredStyle: UIAlertControllerStyleAlert];
     UIAlertAction* defaultAction = [UIAlertAction actionWithTitle: NSLocalizedString(@"OK",@"")
                                                             style: UIAlertActionStyleDefault
                                                           handler: ^(UIAlertAction * action) {}];
     [alert addAction:defaultAction];
     [sender presentViewController:alert animated:YES completion:nil];

Posted in programming, Xcode.

0 Responses

Stay in touch with the conversation, subscribe to the RSS feed for comments on this post.

Some HTML is OK

or, reply to this post via trackback.

Sorry about the CAPTCHA that requires JS. If you really don't want to enable JS and still want to comment, you can send me your comment via e-mail and I'll post it for you.

Please solve the CAPTCHA below in order to fight spamWordPress CAPTCHA