[MonoTouch] Inconsistent behavior creating a UISearchDisplayController in code
Mike Bluestein
mike.bluestein at gmail.com
Sun Nov 29 20:15:58 EST 2009
I was declaring UISearchDisplayController in ViewDidLoad rather than
as a class variable. Once I moved the declaration outside it worked
fine. Thanks to Chris Hardy on irc for helping me work this out.
On Sun, Nov 29, 2009 at 2:41 PM, Mike Bluestein
<mike.bluestein at gmail.com> wrote:
> I'm getting inconsistent behavior creating a UISearchDisplayController
> in code. Sometimes it works whereas most of the time it skips the
> search controller and just acts as if only the search bar were being
> used (so you get a keyboard, but no overlay, etc)??
>
> Here's a snippet that's basically what I'm doing:
>
> [Register("SomeTableViewController")]
> public class SomeTableViewController : UITableViewController
> {
> ... code to wire up source omitted for brevity
>
> public override void ViewDidLoad ()
> {
> base.ViewDidLoad ();
>
> UISearchDisplayController sdc = new UISearchDisplayController
> (CreateSearchBar (), this);
>
> //this should be enough to display the ui from
> the controller even without the Delegate wired up.
>
> ...
>
> }
>
> UISearchBar CreateSearchBar ()
> {
> UISearchBar search = new UISearchBar ();
> search.SizeToFit ();
> search.AutocorrectionType = UITextAutocorrectionType.No;
> search.AutocapitalizationType = UITextAutocapitalizationType.None;
>
> this.TableView.TableHeaderView = search;
>
> return search;
> }
> }
>
More information about the MonoTouch
mailing list