iPhone : making UIBarButtonItem that is arrow shaped

前端 未结 6 1677
抹茶落季
抹茶落季 2020-12-07 23:36

I have a UIBarButtonItem on a navigation bar. I\'d like to make it arrow shaped. By that I mean I want it to be square except for a pointy side. Does anyone know how to do t

6条回答
  •  隐瞒了意图╮
    2020-12-08 00:08

    My problem was renaming the back button that appears on the pushed view controller. I found a dirty workaround and if you ignore the non-ideal animation problem, you'll get a back button with the title you want.

    The trick is to change the title of the first VC in viewWillDisappear and re-set it of course in viewWillAppear

    (Needless to say, by default, if there is no leftBarButtonItem set, UINavigationController will show a back button with the title of the VC that pushed the current VC)

    In the VC where you push your current VC, do

    -(void) viewWillDisappear:(BOOL) animated {
      [super viewWillDisappear:animated];
      self.title = @"Back";
    }
    
    -(void) viewWillAppear:(BOOL) animated {
      [super viewWillAppear:animated];
      self.title = @"Original Title";
    }
    

提交回复
热议问题