ios - How to disable multi click on button? -


i have uitableview:

cell 1: button 1->push view controller a

cell 2: button 2->push view controller b

it works fine. however, when try hold , press 2 buttons @ same time, app receives following warning:

nested push animation can result in corrupted navigation bar. finishing navigation transition in unexpected state. navigation bar subview tree might corrupted.

how should disable multi click button on cell ?

you need disable button while pushing view controller. can create category ofuinavigationcontroller pushing view controller. make sure enable button before coming current viewcontroller

@interface uinavigationcontroller (completionhandler)  - (void)pushviewcontroller:(uiviewcontroller *)viewcontroller               animated:(bool)animated             completion:(void (^)(void))completion;  @end     @implementation uinavigationcontroller (completionhandler) - (void)pushviewcontroller:(uiviewcontroller *)viewcontroller animated:(bool)animated completion:(void (^)(void))completion { [catransaction begin]; [catransaction setcompletionblock:completion]; [self pushviewcontroller:viewcontroller animated:animated]; [catransaction commit]; }   @end 

call below code pushing viewcontroller

[self.navigationcontroller pushviewcontroller:controllerobj animated:yes completion:^{         btn.userinteractionenabled = no; // button object         nslog(@"completed");     }]; 

Comments

Popular posts from this blog

c++ - Difference between pre and post decrement in recursive function argument -

php - Nothing but 'run(); ' when browsing to my local project, how do I fix this? -

php - How can I echo out this array? -