On Thu, 06 Oct 2011 14:33:15 -0500, Heath Borders <heath.bord...@gmail.com> 
said:
>In the UIViewController documentation about the
>searchDisplayController property [1] it says:
>
>If you create your search display controller programmatically, this
>property is set automatically by the search display controller when it
>is initialized.
>
>And when I create my UISearchDisplayController thusly:
>
>[[[UISearchDisplayController alloc] initWithSearchBar:searchBar
>contentsController:self] autorelease];
>
>-[UIViewController searchDisplayController] is not nil. 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.

I think the documentation is (as so often) just wrong. In experimenting with 
this for my book, I found the UIViewController searchDisplayController property 
useless except in the special case where the whole thing is set up 
automatically in the nib. I ignore the searchDisplayController property and 
simply retain the UISearchDisplayController myself in a retain-policy property 
designed for that purpose. See the example here:

<https://github.com/mattneub/Programming-iOS-4-Book-Examples/tree/master/p536p550searchableTable>

And, for what I mean by "where the whole thing is set up automatically in the 
nib", here:

<https://github.com/mattneub/Programming-iOS-4-Book-Examples/tree/master/p557p571automaticSearchPopover>

(But, as my book says, I find that second arrangement very unpleasant, because 
you're not given access to the stuff you need access to, like the popover 
controller.)

m.


--
matt neuburg, phd = m...@tidbits.com, <http://www.apeth.net/matt/>
A fool + a tool + an autorelease pool = cool!
Programming iOS 4!
http://www.apeth.net/matt/default.html#iosbook_______________________________________________

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com

Reply via email to