Ortensia C.
Ortensia C.

Reputation: 4716

add images to UIBarButtonItem of toolbar in ios

I have a UIBarButtonItem that does not take the picture

I have a toolbar with a button UIBarButtonItem above, connected via IBOutlet. The image that I put you do not see.

My code:-

 @interface ViewController : {
   IBOutlet UIToolbar *toolBar;
   IBOutlet UIBarButtonItem * myBackButton;
   IBOutlet UIBarButtonItem * myReloadButton;
   IBOutlet UIBarButtonItem * myHomeButton;
   IBOutlet UIBarButtonItem * myListButton;
   IBOutlet UIBarButtonItem * myCalendarbutton;//the problem is this

 }

the button is connect by IB but does not take the picture.

this is the image

enter image description here

this is the IB

enter image description here

enter image description here

Upvotes: 0

Views: 1053

Answers (1)

Mystery
Mystery

Reputation: 552

UIBarButtonItem will not allow you to put background image. Try to use normal UIButton and try to use image as a background to the UIButton. Get the action of the UIButton and you will get your desired output.

Upvotes: 1

Related Questions