Is there a reason to you are not using half of the things you instantiate? Anyways. I think you got the tabbar concept wrong.
Take a look at this picture: https://dl.dropbox.com/u/2991343/tabbarcontroller.png As you see the TabBarController will be one class, which then instantiates the other controllers as well as NavigationControllers for them. So in TabBarController: private UINavigationController navBingabongController /*** other controllers here ***/; public override void ViewDidLoad () { base.ViewDidLoad (); var bbvc = new BingabongViewController(this); var navCont = new UINavigationController(); navCont.PushViewController(bbvc, false); navCont.TopViewController.Title = "Bingabong"; navBingabongController = navCont; /*** other controllers like above, here ***/ var u = new UIViewController[] {navBingabongController}; this.SelectedViewController = navBingabongController; this.ViewControllers = u; } Then in each of the controllers which you put in the UIViewController[] array, you can access the NavigationItem such that you can set the Left and Right buttons. On Tue, Jun 19, 2012 at 7:30 AM, Alex White <[email protected]> wrote: > Hi, > > I have been trying to work out the best way to layout my navigation through > my application, I hit a number of issues on the way, here is a mock up of > what I am trying to achieve. > > http://i49.tinypic.com/2zi95ps.png > > the important bits are that the images on the top buttons have no borders, > the whole screen is capable of being coloured in what ever style the client > requires, so the use of tint colours and background colours is important. To > get this to work properly I had to do the following, the top is 3 toolbars > one for the left button, one for the right button and one for the title, I > could not find a way to get this to work any other way. > > The bottom is a toolbar as well, the main reason is to get the layouts to > work and being able to colourise the selected icon with a tint colour. > > Is there a better way?? > > With the above approach I thought I would create one controller and subclass > it, but I ran into a number of issues with set selector not set errors that > I could not solve, so then I decided to just create the 5 main screens in IB > and wire it all up, well that did not work, IB kept on crashing and loosing > my outlets, so gave up on that idea. So my final way which I think is the > best way is to create the controls in code, I have looked a lots of examples > and my code just won't run. > > the simplest of examples. > > public override void ViewDidLoad() { > base.ViewDidLoad(); > _tintColour = UIColor.FromRGB(80,80,80); > _tintHighColour = UIColor.FromRGB(255,255,0); > _tbBikeLists = new UIBarButtonItem(); > //_tbBikeLists.Image("Images/Toolbar/Bike.png"); > _tbBikeLists.Style = UIBarButtonItemStyle.Plain; > _tbBikeLists.TintColor = _tintColour; > _toolBar = new UIToolbar(); > _toolBar.Bounds.X = 0; > _toolBar.Bounds.Y = 416; > _toolBar.Bounds.Width = 320; > _toolBar.Bounds.Height = 44; > _toolBar.BackgroundColor = _tintColour; > _toolBar.BarStyle = UIBarStyle.Default; > UIBarButtonItem[] ToolbarItems = new UIBarButtonItem[] {_tbBikeLists}; > // all the issues seem to be down here > this.SetToolbarItems(ToolbarItems,true); > this.NavigationController.ToolbarHidden = false; <--- bombs out on this line > with System.NullReferenceException: Object reference not set to an instance > of an object > this.NavigationController.SetToolbarItems(ToolbarItems, true); > > I am sure it is something simple that I am missing. > > thanks for any help. > > atb > > alex > > > _______________________________________________ > MonoTouch mailing list > [email protected] > http://lists.ximian.com/mailman/listinfo/monotouch > -- Med Venlig Hilsen / With Best Regards Tomasz Cielecki http://ostebaronen.dk _______________________________________________ MonoTouch mailing list [email protected] http://lists.ximian.com/mailman/listinfo/monotouch
