Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>Strictly speaking, you can't directly do what you want because of the constraints of how <code>-performSelectorOnMainThread:</code> works. However, in whatever class <code>self</code> is, you could define a method like this:</p> <pre><code>- (void)doPop { [self.navigationController popViewControllerAnimated:YES]; } </code></pre> <p>then</p> <pre><code>[self performSelectorOnMainThread:@selector(doPop)]; </code></pre> <p>To elaborate as to why you syntax isn't working:</p> <p>The selector passes to <code>-performSelectorOnMainThread:</code> must be a selector that either takes no argument, or a single argument of some sort of <code>id</code>. While <code>-popViewControllerAnimated:</code> is a selector that takes a single argument, that argument is of type <code>BOOL</code> (which by the way uses <code>YES</code> and <code>NO</code> not <code>TRUE</code> and <code>FALSE</code>). </p> <p>As well, the <code>@selector</code> will be just the name of the method, not the object you wish to invoke it upon (in this case, <code>self.navigationController</code>).</p> <p>Think about it in terms of messaging objects. You want the <code>self.navigationController</code> object to perform the <code>-popViewControllerAnimated:</code> selector on the main thread, so you would construct the messaging that way:</p> <pre><code>[self.navigationController performSelectorOnMainThread:@selector(popViewControllerAnimated:) withObject:nil waitUntilDone:NO]; </code></pre> <p>But the problem there is, again, the required argument. So since you cannot directly invoke <code>pop</code> in this manner, that's why my above suggestion. It allows you do invoke <code>perform</code> according to its semantics, then still call <code>pop</code> properly with its semantics.</p>
    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. 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.
    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