[MonoTouch] UIPickerView.Select not working

bryan costanich b at wowzer.net
Wed Oct 28 03:21:51 EDT 2009


hi all,

i have a UIPickerView, i attach a datasource to it, and then i call select on it:

            lstPicker.Model = model;
            //---- if something is already selected
            if (model.SelectedItem != "")
            {
                Console.WriteLine ("model.SelectedItem = " + model.SelectedItem);
                Console.WriteLine ("model.SelectedComponentIndex, model.SelectedRowIndex," + model.SelectedComponentIndex.ToString() + "," + model.SelectedRowIndex.ToString ());
                lstPicker.Select (model.SelectedComponentIndex, model.SelectedRowIndex, true);
            }

but i get an error saying: MonoTouch.Foundation.MonoTouchException: Objective-C exception thrown.  Name: NSRangeException Reason: *** -[NSCFArray objectAtIndex:]: index (1) beyond bounds (1)

but if i look at the model, there is definitely something there.

am i doing something wrong? is there a different way to select an item in a picker view? am i missing a lifecycle thing?
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.ximian.com/pipermail/monotouch/attachments/20091028/3f024dfe/attachment.html 


More information about the MonoTouch mailing list