How to make UIBarButtonItem as follows

How can I create a UIBarButtonItem as follows: enter image description here

I cannot find it in SystemItem values.

thank

+3
source share
3 answers

Maybe something like:

[[UIBarButtonItem alloc] initWithImage:@"info.png" style:UIBarButtonItemStyleBordered target:nil action:nil]

I tried:

UIBarButtonItem *item = [[UIBarButtonItem alloc] initWithCustomView:[UIButton buttonWithType:UIButtonTypeInfoLight]];
item.style = UIBarButtonItemStyleBordered;

but it looks like the border style is not applied with the custom view.

+7
source

The image button that you called the information button. This is a system button,

Use below to get it as rightBarButtonItem

UIButton* myInfoButton = [UIButton buttonWithType:UIButtonTypeInfoLight]; 
[myInfoButton addTarget:self action:@selector(InfoButtonClicked:) forControlEvents:UIControlEventTouchUpInside];
self.navigationItem.rightBarButtonItem = [[UIBarButtonItem alloc] initWithCustomView:myInfoButton];

Here is a link to the documentation on UIButtonType

+18
source

@Jhaliya -:

let infoButton = UIButton(type: .InfoLight)

infoButton.addTarget(self, action: "InfoButtonClicked:", forControlEvents: .TouchUpInside)

let infoBarButtonItem = UIBarButtonItem(customView: infoButton)

navigationItem.rightBarButtonItem = infoBarButtonItem
+1
source

All Articles