Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>I would be willing to bet that this is a bug on Apple's part as I am running into the exact same problem. The reason being is that I can get a custom <code>UIBarButtonItem</code> to appear, but only when I <strong>don't</strong> try to use the <code>initWithCustomView:</code> method. Per the API, the navigation controller checks the following things when a new view controller is pushed:</p> <ol> <li>If the new top-level view controller has a custom left bar button item, that item is displayed. To specify a custom left bar button item, set the leftBarButtonItem property of the view controller’s navigation item.</li> <li>If the top-level view controller does not have a custom left bar button item, but the navigation item of the previous view controller has a valid item in its backBarButtonItem property, the navigation bar displays that item.</li> <li>If a custom bar button item is not specified by either of the view controllers, a default back button is used and its title is set to the value of the title property of the previous view controller—that is, the view controller one level down on the stack. (If there is only one view controller on the navigation stack, no back button is displayed.)</li> </ol> <p>My case (as well as yours) is 2. I specify code <strong>exactly</strong> the same as yours (i.e., creating a <code>UIButton</code>, setting its <code>image</code> properties for various states, creating a <code>UIBarButtonItem</code>, initializing it with the <code>UIButton</code>, then setting my current view controller's <code>backBarButtonItem</code> property to the <code>UIBarButtonItem</code>); however, when I later push my view controller, nothing at all is displayed on the left-hand side of my navigation controller. Strangely, I can click where the "Back" button should be, and it pops the view controller.</p> <p>Interestingly, if I create a <code>UIBarButtonItem</code> using the <code>initWithTitle:style:target:action:</code> method instead of the <code>initWithCustomView:</code> method, it <strong>does</strong> show a custom button with a custom title. Also, as Travis mentioned, using the <code>leftBarButtonItem</code> property instead works just fine. I'd rather adhere to the sanctioned logic, however, by specifying the "Back" button for the current view controller -- to be displayed later when a new view controller is pushed -- instead of creating a left button for the next view controller, which, arguably, should have no concern for anything pertaining to the view controller that came before it. :-\</p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. VO
      singulars
      1. This table or related slice is empty.
    2. VO
      singulars
      1. This table or related slice is empty.
    3. VO
      singulars
      1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload