ios - iOS7 and iOS8 segue.destinationViewController -
i'm trying make app work both ios7 , ios8 , ran problem in prepareforsegue methods in view controllers.
in ios8 segue.destinationviewcontroller
of class uinavigationcontroller, use [[segue.desinationviewcontroller viewcontrollers] objectatindex:0]
works fine, in ios7 segue.desinationviewcontroller
of class cmamyviewcontrollerclassname, throw error when try send viewcontollers
message it.
i found this solution work, wondering if there's better solution? other latter post haven't been able find it. if there's not "proper" solution, i'll create method gets correct view controller; wondering how other people handled situation.
thanks!
this issue resolved checking class of destination view controller before trying access 1 of properties:
- (void)prepareforsegue:(uistoryboardsegue *)segue sender:(id)sender { destcontroller *vc = segue.destinationviewcontroller; if ([dvc iskindofclass:[destcontroller class]]) dvc.propertyname = @"property value"; else // else }
taken solution in this thread.
Comments
Post a Comment