Adding a UIBarButtonItem programmatically to UINavigationBar

前端 未结 4 889
执念已碎
执念已碎 2021-01-07 19:21

I dropped in a UINavigationBar in UIInterfaceBuilder. I present this view modally and just want a UIBackBarButton to return to my last

4条回答
  •  夕颜
    夕颜 (楼主)
    2021-01-07 20:02

    You may use this setters without creation new UIBarButtonItem:

    [self.navigationItem.leftBarButtonItem setAction:@selector(doBackButton:)];
    [self.navigationItem.leftBarButtonItem setTarget:self];
    

提交回复
热议问题