Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>You have several problems:</p> <p>1) You are calling <code>popViewController:</code> on what I asssume is a <code>UIViewController</code> subclass, when you should be calling it on your <code>UINavigationController</code>.</p> <p>2) <code>popViewController:</code> takes a bool value for whether to animate that transition. With the action, it gets passed the sender by default.</p> <p>3) You then reassign the target and action for the button (but these don't get called when you create the <code>UIBarButtonItem</code> using the <code>initWithCustomView:</code> initializer: <a href="http://developer.apple.com/library/ios/#documentation/uikit/reference/UIBarButtonItem_Class/Reference/Reference.html" rel="nofollow">See docs</a>).</p> <hr> <p>How to fix this:</p> <p>1) Call a method you create for the button handler:</p> <pre><code>UIButton *bt=[UIButton buttonWithType:UIButtonTypeCustom]; [bt setFrame:CGRectMake(0, 0, 50, 30)]; [bt setImage:[UIImage imageNamed:@"menu.png"] forState:UIControlStateNormal]; [bt addTarget:self action:@selector(buttonTouched:) forControlEvents:UIControlEventTouchUpInside]; UIBarButtonItem *leftButton=[[UIBarButtonItem alloc] initWithCustomView:bt]; self.navigationItem.leftBarButtonItem=leftButton; </code></pre> <p>2) In that method, pop the view controller, or do whatever you actually want to do:</p> <pre><code>- (void)buttonTouched:(id)sender { [self.navigationController popViewController:YES]; //Or what you assigned to the button action: [self.revealViewController revealToggle:(not sure what you're supposed to have here)]; } </code></pre>
    singulars
    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. VO
      singulars
      1. This table or related slice is empty.
    2. 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