ios - disable DeviceOrientationNotification as long as calculation is running -
my app doing calculations , showing results in graph. when device rotating new uiviewcontroller
generated showing graph in landscape-oriented view. therefore necessary parameters passed new viewcontroller create graph. app crashing when device turned landscape when calculation still running.
is there proper way disable used deviceorientationnotification
temporarily?
-(void)calculate { disable deviceorientationnotification ...calculation code here enable deviceorientationnotification again }
thanks (don't beat me again, if question appears stupid)
in ios 5 , 6 there call on uiviewcontrollers autorotation. set flag when start calculation shouldn't autorotate , set when done.
//somewhere in .h or class extension or simple member variable @property (nonatomic) bool shouldrotate; // ios 6 - (bool)shouldautorotate { return self.shouldrotate; } - (nsuinteger)supportedinterfaceorientations { return uiinterfaceorientationmaskportrait;//return supported } // pre-ios 6 support - (bool)shouldautorotatetointerfaceorientation:(uiinterfaceorientation)tointerfaceorientation { return self.shouldrotate && //other interface check; } -(void)calculate{ self.shouldrotate = no; //do calculation self.shouldrotate = yes; }
Comments
Post a Comment