objective c - iOS - Stop Modal UIViewController from getting presented -
i have modal uiviewcontroller. on receiving low memory warning, want close modal. purpose, wrote following code -
- (void)didreceivememorywarning { [self dismissviewcontrolleranimated:yes completion:nil]; [super didreceivememorywarning]; } this works fine in cases. however, when have initialized view controller, not yet presented on screen, , memory warning occurs @ time, code execution continues, modal not dismissed because not yet presented, , when execution reaches point gets presented, modal still shows up.
how go handling scenario , prevent modal being presented? please let me know if not clear - try explain better.
can check results according below code...
- (void)didreceivememorywarning { if(!self.myvc) { [self presentviewcontroller:myvc animated:no completion: { [self dismissviewcontrolleranimated:no completion:nil];}]; } else [self dismissviewcontrolleranimated:yes completion:nil]; }
Comments
Post a Comment