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

Popular posts from this blog

php - Why I am getting the Error "Commands out of sync; you can't run this command now" -

linux - Does gcc have any options to add version info in ELF binary file? -

java - Are there any classes that implement javax.persistence.Parameter<T>? -