[MonoTouch] Programmatically creating a TabViewController

Tim Scott tscott at lunaversesoftware.com
Wed Aug 26 13:06:32 EDT 2009


I don't understand.  UITabBarController does not have tabBarItem.  Are you
talking about something like this:

tabBarController.TabBar.Items[0] = new
UITabBarItem(UITabBarSystemItem.Favorites, 1);

This does not seem to work, and besides it seems wrong.  Because the tabs
are set via UITabBarController.SetViewControllers method I would expect that
each UIViewController passed into this method should specify its own tab as
it does in Obj C.



On 8/26/09 10:23 AM, "Geoff Norton" <gnorton at novell.com> wrote:

> Use UITabBarController not UIViewController, as this is the actually
> controller type for a UITabBar :)
> 
> -g
> 
> On 26-Aug-09, at 11:17 AM, Tim Scott wrote:
> 
>> Ethan,
>> 
>> Did you ever figure this out?  I have been watching the Stanford
>> series on
>> IPhone programming, and it shows setting tab bars items for a view
>> controllers just as you say.  That is, in ObjC, you assign
>> UIViewControler.tabBarItem a UITabBarItem instance.  In MonoTouch,
>> there is
>> no like property or method that I can see.  How do you set the image
>> for
>> each tab programmatically in MonoTouch?
>> 
>> Tim
>> 
>> On 8/24/09 5:16 PM, "monotouch-request at lists.ximian.com"
>> <monotouch-request at lists.ximian.com> wrote:
>> 
>>> Ok, let me make sure I understand things correctly.  I'm creating a
>>> UITabBarController which is a container for my tabs.   Each Tab is
>>> essentially an implementation of UIViewController with the tabBarItem
>>> property set to have the details of how the tab should be
>>> displayed.  (I'm
>>> setting this using the UITabBarController.ViewControllers property
>>> to an
>>> array of my View Controllers.)  The problem I'm having is that
>>> there is *no
>>> tabBarItem property available in UIViewController*, which is what
>>> I'm used
>>> to from ObjC land.  Am I on the right track here, or am I missing
>>> something?
>>> 
>>> - Ethan Nagel
>>>  President, Nagel Technologies, Inc.
>>>  enagel at nageltech.com
>>>  http://www.nageltech.com
>>>  (c) 831.247.5702
>>> 
>>> 
>>> On Mon, Aug 24, 2009 at 11:21 AM, Geoff Norton <gnorton at novell.com>
>>> wrote:
>>> 
>>>> You're looking for UITabBarController, rather than a regular
>>>> UIViewController.
>>>> 
>>>> -g
>>>> 
>>>> On 24-Aug-09, at 3:48 AM, Ethan Nagel wrote:
>>>> 
>>>> I've got an open question on creating a TabViewController using
>>>> Interface
>>>>> Builder, but in the mean time I was wondering if someone could
>>>>> guide me in
>>>>> creating a TabViewController programatically.  I can create the
>>>>> TabViewController, but there is no "tabBarItem" property in
>>>>> UIViewController
>>>>> to allow me to configure each tab.  I tried creating the
>>>>> UITabBarItem and
>>>>> assigning it to "tabBarItem" using
>>>>> UIViewController.SetNativeField, but that
>>>>> didn't seem to have any effect.
>>>>> 
>>>>> - Ethan
>>>>> _______________________________________________
>>>>> MonoTouch mailing list
>>>>> MonoTouch at lists.ximian.com
>>>>> http://lists.ximian.com/mailman/listinfo/monotouch
>>>>> 
>>>> 
>>>> 
>> 
>> 
>> _______________________________________________
>> MonoTouch mailing list
>> MonoTouch at lists.ximian.com
>> http://lists.ximian.com/mailman/listinfo/monotouch
> 




More information about the MonoTouch mailing list