Add target to stock back button in navigationBar

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

    Off of the top of my head. Try something like this

    UITapGestureRecognizer *tap = [[UITapGestureRecognizer alloc]
                                          initWithTarget:self action:@selector(goBack:)];
    tap.numberOfTapsRequired = 1;
    [self.navigationItem.backBarButtonItem addGestureRecognizer:tap];
    

提交回复
热议问题