ios7 - Check ios versions then call functions of uiviewcontroller accordingly -
ios7 - Check ios versions then call functions of uiviewcontroller accordingly -
i stuck orientation issue in ipad versions. app designed in such way supports ios 6 till ios 8.
according apple since willanimaterotationtointerfaceorientation: deprecated ios8, used viewwilltransitiontosize: ios8.
when nail issue, first solution providing macros decide version either ios 8 or below , perform functions accordingly.
#ifdef __iphone_8_0 // works on >= version 8.0 - (void)viewwilltransitiontosize:(cgsize)size withtransitioncoordinator:(id<uiviewcontrollertransitioncoordinator>)coordinator { [super viewwilltransitiontosize:size withtransitioncoordinator:coordinator]; // code go here ios 8 } #else // works on < version 8.0 - (void)willanimaterotationtointerfaceorientation:(uiinterfaceorientation)interfaceorientation duration:(nstimeinterval)duration { // code go here when version below 8.0 } #endif
i checked , run it.. received output expected.
but said code wrong.. trying turn version checking compile-time decision. version checking must runtime decision. both ios7 , ios8 code must both compiled executable.
so changed function below without version check:
-(void)viewwilllayoutsubviews { [super viewwilllayoutsubviews]; // code go here without version check }
i'm hardly unable understand line "both ios7 , ios8 code must both compiled executable." - mean.
wish know why shouldn't provide compile-time decision?
also if want it... without using notification.. there way through can able handle calling these functions @ runtime version check?
kindly allow me have comments on this.
ios ios7 ios6 ios8
Comments
Post a Comment