Note that there are some explanatory texts on larger screens.

plurals
  1. POUIViewController does not retain its programmatically-created UISearchDisplayController
    primarykey
    data
    text
    <p>In the <code>UIViewController</code> <a href="http://developer.apple.com/library/ios/#DOCUMENTATION/UIKit/Reference/UIViewController_Class/Reference/Reference.html#//apple_ref/occ/instp/UIViewController/searchDisplayController" rel="nofollow noreferrer">documentation</a> about the <code>searchDisplayController</code> property <a href="http://developer.apple.com/library/ios/#DOCUMENTATION/UIKit/Reference/UIViewController_Class/Reference/Reference.html#//apple_ref/occ/instp/UIViewController/searchDisplayController" rel="nofollow noreferrer">1</a> it says:</p> <p>If you create your search display controller programmatically, this property is set automatically by the search display controller when it is initialized.</p> <p>And when I create my UISearchDisplayController thusly:</p> <pre><code>[[[UISearchDisplayController alloc] initWithSearchBar:searchBar contentsController:self] autorelease]; </code></pre> <p><code>-[UIViewController searchDisplayController]</code> is not <code>nil</code>. However, it is nilled out after the event loop finishes, which causes the search display controller not to show when I touch inside the search bar. Nothing crashes. This is very weird. If I omit the call to <code>autorelease</code>, everything works:</p> <pre><code>[[UISearchDisplayController alloc] initWithSearchBar:searchBar contentsController:self]; </code></pre> <p>However, leaks the <code>UISearchDisplayController</code> (I verified this with Instruments). Since the <code>searchDisplayController</code> <a href="http://developer.apple.com/library/ios/#DOCUMENTATION/UIKit/Reference/UIViewController_Class/Reference/Reference.html#//apple_ref/occ/instp/UIViewController/searchDisplayController" rel="nofollow noreferrer">property</a> is marked as <code>(nonatomic, retain, readonly)</code> I expect that it would retain the <code>UISearchDisplayController</code> after it is set.</p> <p><a href="https://stackoverflow.com/q/2395272/9636">This stackoverflow article</a> is related.</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.
 

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