0
votes

I am currently trying to perform a iOS trash-style custom segue which involves the popping and pushing of view controllers of the same class (the destination view controller is instantiated via the storyboard.) I would like to disable one of the toolbar UIBarButtonItems during a segue in order to prevent the user from accidentally clicking on it as the trash animation is being performed. however, it seems that simply calling self.deleteButton.enabled = NO; doesn't work. If I take out the segue line, the button is disabled.

2
How did you declare the button?James Harnett
It was created the button in the storyboard and I set the reference outlet to the deleteButton variable in the view controller.user1927638
Please add the code where you are trying to disable the button, are you using prepareForSegue:?Suhas

2 Answers

0
votes

in the method

- (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender{

    if([[segue identifier] isEqualToString:@"YourView"]){

        self.btnItem.enabled = NO;
     }
}
0
votes

I eventually came up with a solution. Since I was performing a custom segue with a custom animation, I began by disabling the bar button on the destination view controller as soon as it has been pushed into the navigation controller. In the completion block of my custom animation, I simply reenable the button again. Hope this helps.