Add target to stock back button in navigationBar

前端 未结 6 1868
我在风中等你
我在风中等你 2021-01-14 18:48

I am setting the values of the title and back button in the UINavigationBar as follows:

self.navigationItem.title = @\"Post\";
[self.navigationC         


        
6条回答
  •  抹茶落季
    2021-01-14 19:13

    You can not change backBarButtonItem action in such a way.

    I see here 2 possible solutions:

    1. To implement you custom back button do whatever you want with its actions

    2. Here is nice solution how to override standart back event and block popViewController when needed

    https://github.com/onegray/UIViewController-BackButtonHandler/tree/master

提交回复
热议问题