lundi 1 décembre 2014

iOS7 and iOS8 segue.destinationViewController

I'm trying to make my app work with both iOS7 and iOS8 and I ran into a problem in my prepareForSegue methods in my view controllers.


In iOS8 segue.destinationViewController is of class UINavigationController, so I use [[segue.desinationViewController viewControllers] objectAtIndex:0] which works fine, but in iOS7 segue.desinationViewController is of class CMAMyViewControllerClassName, which will obviously throw an error when I try to send a viewContollers message to it.


I found this solution which will work, but I was wondering if there's a better solution? Other than the latter post I haven't been able to find anything about it. If there's not a "proper" solution, I'll create a method that gets the correct view controller; I was just wondering how other people handled this situation.


Thanks!




Aucun commentaire:

Enregistrer un commentaire