Not sure if you have fixed this, but:
> this.View.AddSubview (mainTabBar); Will always generate: > "Error CS1502: The best overloaded method match for > `MonoTouch.UIKit.UIView.AddSubview(MonoTouch.UIKit.UIView)' has some invalid > arguments (CS1502)" > > And: > > "Error CS1503: Argument `#1' cannot convert `SaleSitesb5.TabBarController' > expression to type `MonoTouch.UIKit.UIView' (CS1503)" Because you are passing in a UITabBarController, which is a UIViewController.... etc. try: this.View.AddSubview (mainTabBar.View); :) On Fri, Jun 15, 2012 at 9:33 PM, Chris_M <[email protected]> wrote: > > The examples I have found for using a UITabBarController use the tab bar as > the sole means of navigating from that view -- the tab bar in effect is the > view (and whatever it displays as a result of a button being tapped). > > But let's say that I have a MainViewController (a UIViewController) that has > some buttons at the top part of the screen, a UITableView in the middle. At > the bottom of the screen I want to have a tab bar with some buttons that, > when tapped, bring up a new view, with the idea that the user can then tap > the "Back" button on the nav bar of the new views to return again to the > MainViewController. > > Following the Xamarin example, I wrote a TabBarController (a > UITabBarController) class file and put the code to set up the tab bar and > its functionality in that class' constructor. Back in my > MainViewController's ViewDidLoad I added the following code: > > mainTabBar = new TabBarController (); > mainTabBar.View.Frame = new RectangleF (0, tabbarVert, > this.View.Frame.Width, tabbarHeight); > > That code compiles without any errors or warnings, as does my > TabBarController class file. So far, so good. > > To add the tab bar to my MainViewController's view, I added the following > code: > > this.View.AddSubview (mainTabBar); > > When I compile, this generates a couple of errors: > > "Error CS1502: The best overloaded method match for > `MonoTouch.UIKit.UIView.AddSubview(MonoTouch.UIKit.UIView)' has some invalid > arguments (CS1502)" > > And: > > "Error CS1503: Argument `#1' cannot convert `SaleSitesb5.TabBarController' > expression to type `MonoTouch.UIKit.UIView' (CS1503)" > > I tried making my TabBarController class a UITabBar instead of a > UITabBarController, although I couldn't find any examples online of anyone > doing that, but when I compile I get an error message because UITabBar > doesn't have a ViewControllers member, and I assume that without that > ViewControllers the tab bar won't function properly. > > So how I can create a tab bar and add it to my MainViewController and have > it function properly? > > > --Chris > > > -- > View this message in context: > http://monotouch.2284126.n4.nabble.com/Problem-Adding-a-Tab-Bar-to-My-Main-View-tp4655417.html > Sent from the MonoTouch mailing list archive at Nabble.com. > _______________________________________________ > MonoTouch mailing list > [email protected] > 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 [email protected] http://lists.ximian.com/mailman/listinfo/monotouch
