How do I hide/show the right button in the Navigation Bar

前端 未结 18 2029
后悔当初
后悔当初 2020-12-12 19:25

I need to hide the right button in the Navigation Bar, then unhide it after the user selects some options.

Unfortunately, the following doesn\'t work:



        
18条回答
  •  渐次进展
    2020-12-12 19:39

    Show:

    [self.navigationItem.rightBarButtonItem.customView setAlpha:1.0];
    

    Hide:

    [self.navigationItem.rightBarButtonItem.customView setAlpha:0.0];
    

    You can even animate its showing/hiding

    [UIView animateWithDuration:0.2 animations:^{
            [self.navigationItem.rightBarButtonItem.customView setAlpha:1.0];
    
        }];
    

提交回复
热议问题