Hi Alex,

When you create a UISearchDisplayController, you can pass it a UISearchBar.

I will say that using a UISearchDisplayController can be very confusing the
first time you use it, so I might suggest taking a look at
https://github.com/jstedfast/MonoTouch.SQLite

You'll see how I setup a UISearchDisplayController in the
AllInOneUITableViewController (mostly what this class does is to simplify
the use of UITableViewControllers so that you don't have to create all the
different delegate classes, etc).

Jeff

On Tue, Jun 5, 2012 at 10:51 AM, Alex White <alexwhit...@gmail.com> wrote:

> Hi Nic,
>
> thanks for the reply,
>
> I have tried the following code in the ViewDidAppear and ViewDidLoad and
> both give me a null issue,
>
> searchBar = new UISearchBar (f){
> Delegate = new SearchDelegate (),
> ShowsCancelButton = true,
> } ;
> string[] buttons = new string[] { "POI", "Road", "Postcode"} ;
> searchBar = new UISearchDisplayController();
> searchBar.ScopeButtonTitles = buttons;
> searchBar.ShowsScopeBar = true;
> searchBar.SizeToFit();
> this.SearchDisplayController.SearchBar = searchBar; <-- this errors
> saying readonly
>
>
> I have also tried the following in the events above
>
> string[] buttons = new string[] { "POI", "Road", "Postcode"} ;
> UISearchDisplayController POIsearch = new UISearchDisplayController();
> POIsearch.SearchBar.ShowsScopeBar = true; <<--- fails here
> POIsearch.SearchBar.ScopeButtonTitles = buttons;
>
> I just need to see a working example to be able to see where I am going
> wrong, TBH I have tried so many things now that I am about to drop that
> part of the project until I can find an answer I spent the whole of
> yesterday googling for an answer and nothing worked.
>
> Thanks
>
> Alex
>
> On 5 Jun 2012, at 13:57, Nic Wise wrote:
>
> You may need to show the dialog before it creates the search bar -
> this happens with NavigationBars too.
>
> On Tue, Jun 5, 2012 at 12:40 PM, Alex White <alexwhit...@gmail.com> wrote:
>
> Hi,
>
>
> I am new to MT and MT.D, I am trying to get my head round how to properly
>
> structure the search bar with search scope, I have not found any working
>
> examples of SQLite IList into a the tableview.source of an inherited
>
> dialogviewcontroller, and then to get the searching to work, I have got the
>
> first load of the data working ok I am not getting anywhere with subsequent
>
> of that data.
>
>
> In my constructor of my inherited class I have the following
>
>
> base.AutoHideSearch = true;
>
> base.Autorotate = true;
>
> base.EnableSearch = true;
>
>
>
> Am I right in thinking that the ILIST<> is persisted at the class level and
>
> that the searches don't go back out to the database to build the searches
>
> but work off the loaded data?
>
>
> I am also needing to get the search scope buttons into the search bar, but
> I
>
> am hitting null errors with the following code
>
>
> string[] buttons = new string[] { "POI", "Road", "Postcode"} ;
>
> UISearchDisplayController POIsearch = new UISearchDisplayController();
>
> POIsearch.SearchBar.ShowsScopeBar = true; <<--- fails here
>
> POIsearch.SearchBar.ScopeButtonTitles = buttons;
>
>
> I am sure that all of the issues are my lack of understanding and not bugs
>
> so any example code just to get me going would be great.
>
>
> Thanks in advance
>
>
> Alex
>
>
>
> _______________________________________________
>
> MonoTouch mailing list
>
> MonoTouch@lists.ximian.com
>
> http://lists.ximian.com/mailman/listinfo/monotouch
>
>
>
>
>
> --
> Nic Wise
> t.  +44 7788 592 806 | @fastchicken | http://www.linkedin.com/in/nicwise
> b. http://www.fastchicken.co.nz/
>
> Earnest: Self-employed? Track your business expenses and income.
> http://earnestapp.com
> Nearest Bus: find when the next bus is coming to your stop.
> http://goo.gl/Vcz1p
> mobileAgent (for FreeAgent): get your accounts in your pocket.
> http://goo.gl/IuBU
> Trip Wallet: Keep track of your budget on the go: http://goo.gl/ePhKa
> London Bike App: Find the nearest Boris Bike, and get riding!
> http://goo.gl/Icp2
>
>
>
> _______________________________________________
> MonoTouch mailing list
> MonoTouch@lists.ximian.com
> http://lists.ximian.com/mailman/listinfo/monotouch
>
>
_______________________________________________
MonoTouch mailing list
MonoTouch@lists.ximian.com
http://lists.ximian.com/mailman/listinfo/monotouch

Reply via email to