Hi, I was wondering if its possible to add a tab bar item when a button is clicked. I have a tab bar item created already and i want to create new instances of it and display them in the tab bar.
I tried following this example.. http://docs.xamarin.com/recipes/ios/content_controls/tab_bar/create_a_tab_bar
And so far what I did was create a new tab bar controller in the ios designer. And linked it to the CourseEvalViewController (the uiview controller that I want to crate new instances of).
I then created a new class for the UITabBarController..
public partial class TabBarTroll : UITabBarController
{
private UIViewController[] tabs = new UIViewController[50];
public TabBarTroll (IntPtr handle) : base (handle)
{
}
public TabBarTroll()
{
}
int inc = 0;
public void AddTab()
{
for(int i=0;i<tabs.Length; i++)
{
tabs [i] =
new CourseEvalViewController {
Title = "Course " + ++inc,
TabBarItem = new UITabBarItem (UITabBarSystemItem.History,0)
{
Image = UIImage.FromFile ("Assets/idcard.png")
}
};
}
ViewControllers = tabs;
}
}
I then call it from the CourseEvalViewController.cs..
TabBarTroll tbt = new TabBarTroll();
partial void AddBtn_TouchUpInside (UIButton sender)
{
tbt.AddTab();
}
But When I press the Add Button, it doesnt do anything.