Showing posts with label iOS 6. Show all posts
Showing posts with label iOS 6. Show all posts

Tuesday, September 25, 2012

presentModalViewController deprecated in iOS 6

As a follow up to the last post, I also had presentModalViewController all over my app and it too has been deprecated. I quickly found the answer


A Lot of Functions are deprecated - iOs 6

PhilipCB answered:

[self presentModalViewController:pNewController animated:YES];
can be replaced by
[self presentViewController:pNewController animated:YES completion:nil];
which is really a great improvement because it gives us a completion block at the end. Thus, if you had any upkeep you needed to do after presenting the new view controller, you can assure it only happens once the view controller has successfully loaded.

Additionally dismissModalViewControllerAnimated has also been deprecated and replaced with a similar function to the presenting.

[self dismissViewControllerAnimated:controller completion:nil];






UITextAlignment Deprecated in iOS 6

I just switched my app over to point at iOS 6 and got hammered with 67 warnings, most being 'UITextAlignmentCenter' is deprecated: first deprecated in iOS 6.0' and thus, I needed to figure out what the new alignment class was. A quick search brought  me back to Stack Overflow and I found my answer. NSText! It has all the same alignment's that UIText did so a quick replacement of all my old code and I was happily on my way.


UILabel Align Text to center

Aravindhanarvi answered:

From iOS 6 and later UITextAlignment is deprecated. use NSTextAlignment
myLabel.textAlignment = NSTextAlignmentCenter;