How to add a right button to a UINavigationController?

后端 未结 21 1180
不思量自难忘°
不思量自难忘° 2020-11-28 18:25

I am trying to add a refresh button to the top bar of a navigation controller with no success.

Here is the header:

@interface PropertyViewController          


        
21条回答
  •  情书的邮戳
    2020-11-28 18:57

    Try this.It work for me.

    Navigation bar and also added background image to right button.

     UIBarButtonItem *Savebtn=[[UIBarButtonItem alloc]initWithImage:[[UIImage    
     imageNamed:@"bt_save.png"]imageWithRenderingMode:UIImageRenderingModeAlwaysOriginal] 
     style:UIBarButtonItemStylePlain target:self action:@selector(SaveButtonClicked)];
     self.navigationItem.rightBarButtonItem=Savebtn;
    

提交回复
热议问题