ios - Wrong UIBarButtonItem positioning when going from search result table -


I'm making a UIBarButtonItem right side of my navigation bar with this code:

  - (zero) setupImageTrashButton {UIButton * menuButton = [[UIButton alloc] init]; UIImage * backgroundColor = [UIImage imageNamed: @ "trash"]; [Menu button set image: color for background: state: UIControlStateNormal]; [[View menu button image] Set ContentMode: UIViewContentModeCenter]; UIBarButtonItem * barMenuButtonItem = [[UIBarButtonItem alloc] initWithCustomView: MenuBoots]; [Menu button addTarget: auto action: control event for @Selector (Delete): UIControlEventTouchUpInside]; Self.navigationItem.rightBarButtonItem = barMenuButtonItem; Self.navigationItem.rightBarButtonItem.style = UIBarButtonItemStyleBordered; }  

This works fine when I reach that search controller with a search result table (clicking on a search result table cell, that sequence controller does one segue) Works fine except for

Photos of the problem: right case

Any thoughts?

You might want to set a frame for your UIButton:

 < Code> UIButton * menuButton = [[UIButton alloc] init]; MenuButton.frame = CGRectMake (0, 0, 44, 44); // or the dimension ...  

Comments