We have added UIBarButtonItem
using storyboard and at runtime on click we wanted to change its image ( functionality similar to add bookmark /remove bookmark).
Researched on stack overflow.. lot of folks recommended using UIButton
inside UIBarbuttonItem
.
Below code changes image but its stretched ( even original image is showing as stretched.
Can anyone guide us for changing image only using UIBarButton
( not using UIButton
)?
[_barButtonAddToFav setBackgroundImage:[UIImage imageNamed:@"ic_add_to_fav.png"] forState:UIControlStateNormal barMetrics:UIBarMetricsDefault];