[MonoTouch] Inconsistent behavior creating a UISearchDisplayController in code

Mike Bluestein mike.bluestein at gmail.com
Sun Nov 29 14:41:27 EST 2009


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