Disable/Enable back button from detail view

2019-01-26 03:38发布

How can I disable the back button from the detail view controller?

2条回答
再贱就再见
2楼-- · 2019-01-26 04:09

Depending on your configuration:

self.navigationItem.hidesBackButton = YES;

OR:

self.navigationController.navigationItem.hidesBackButton = YES;

Or, if you just want to disable the button without hiding it, you can use this.

self.navigationController.navigationItem.backBarButtonItem.enabled = NO;
查看更多
一纸荒年 Trace。
3楼-- · 2019-01-26 04:34

You can use the UINavigationItem hidesBackButton to hide it:

self.navigationItem.hidesBackButton = YES;
查看更多
登录 后发表回答