UINavigationBar BarButtonItem with Plain Style

前端 未结 8 2189
不思量自难忘°
不思量自难忘° 2020-12-14 09:19

i got the following code:

- (id)init {
  if (self = [super init]) {
      self.title = @\"please wait\";
      UIBarButtonItem *favorite = [[UIBarButtonItem          


        
8条回答
  •  囚心锁ツ
    2020-12-14 09:39

    Although Frank is right, this code should be in viewDidLoad, the issue here is what BarButtons look like. If you want it to look different, you need to use a different type of UIView. You can add a UIButton to a UIToolbar just fine.

    -(void)viewDidLoad {
      [super viewDidLoad];
      self.title = @"please wait";
      self.navigationItem.rightBarButtonItem = [[[UIButton alloc] init] autorelease];
    }
    

    Edit:

    Sorry, you wanted a plain UIBarButtonItem. I don't believe you can do this with a UINavigationBar. You could try adding a UserInteractionEnabled UILabel as the rightBarButtonItem, I'm not sure if it will work or not.

    Seems this isn't currently possible.
    sbwoodside has a solution.

提交回复
热议问题