Add target to stock back button in navigationBar

前端 未结 6 1947
我在风中等你
我在风中等你 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:10

    I have two solutions for you, giving that you cannot add a target or action to your back button:

    1- Add a new barButtonItem and call it whatever and add your selector to it, and put it in the navigationItem.leftBarButtonItem. Don't forget to pop!

    2- Override the viewWillDisAppear method, and do whatever you wanna do there.. if your viewcontroller doesn't direct you to another viewcontroller but the previous one...

    if you have any more questions, just ask (Y)

提交回复
热议问题