Custom UINavigationBar's backButton?

前端 未结 3 1235
青春惊慌失措
青春惊慌失措 2021-01-02 20:58

I am making a iPhone app that allows the user to go back in a UINavigationBar. However, the way it looks now is horrendous. I am trying to customize it with my own image (mi

3条回答
  •  爱一瞬间的悲伤
    2021-01-02 21:33

    If you want to add UIButton to navigation bar via obj-c, your code should look like this:

    UIButton *button = /* initialize your button */
    
    UIBarButtonItem *barButtonItem = [[UIBarButtonItem alloc] initWithCustomView:button];
    [self.navigationItem setLeftBarButtonItem:barButtonItem];
    

提交回复
热议问题