Hi guys,
Building my first Xamarin iOS app which uses a TabBarController for the UI navigation.
I have the tab bar navigation working nicely and a view controller displaying which corresponds to each option in the tab bar.
I've also managed to customise the title bar background color as well as the status bar icon color to my liking.
But I simply can't see any title text appearing anywhere when I navigate using the tab bar, it's always blank / missing.
This is the contents of my AppDelegate.cs FinishedLaunching method:
public override bool FinishedLaunching (UIApplication application, NSDictionary launchOptions)
{
Window = new UIWindow(UIScreen.MainScreen.Bounds);
UINavigationController navController = new UINavigationController();
navController.PushViewController(new TabBarController(), false);
navController.NavigationBarHidden = false;
navController.NavigationBar.BarStyle = UIBarStyle.Black;
navController.NavigationBar.TintColor = UIColor.White;
navController.NavigationBar.BarTintColor = UIColor.FromRGB(111, 183, 49);
navController.NavigationBar.Translucent = false;
navController.NavigationBar.TitleTextAttributes = new UIStringAttributes()
{
Font = UIFont.FromName("HelveticaNeue-Light", 24),
ForegroundColor = UIColor.White
};
Window.RootViewController = navController;
Window.MakeKeyAndVisible();
return true;
}
And this is the contents of my TabBarController class:
class TabBarController : UITabBarController
{
UIViewController tabProjects, tabRecord, tabFieldGuide, tabAccount;
public override void ViewDidLoad()
{
base.ViewDidLoad();
tabProjects = new ProjectsViewController();
tabProjects.Title = "PROJECTS";
tabProjects.TabBarItem = new UITabBarItem("Projects", UIImage.FromBundle("TabIconProjects"), 0);
tabProjects.View.BackgroundColor = UIColor.White;
tabRecord = new RecordViewController();
tabRecord.Title = "RECORD";
tabRecord.TabBarItem = new UITabBarItem("Record", UIImage.FromBundle("TabIconRecord"), 1);
tabRecord.View.BackgroundColor = UIColor.White;
tabFieldGuide = new FieldGuideViewController();
tabFieldGuide.Title = "FIELD GUIDE";
tabFieldGuide.TabBarItem = new UITabBarItem("Field Guide", UIImage.FromBundle("TabIconFieldGuide"), 2);
tabFieldGuide.View.BackgroundColor = UIColor.White;
tabAccount = new AccountViewController();
tabAccount.Title = "ACCOUNT";
tabAccount.TabBarItem = new UITabBarItem("Account", UIImage.FromBundle("TabIconAccount"), 3);
tabAccount.View.BackgroundColor = UIColor.White;
var tabs = new UIViewController[] { tabProjects, tabRecord, tabFieldGuide, tabAccount };
ViewControllers = tabs;
SelectedViewController = tabs[0];
}
public override void ItemSelected(UITabBar tabbar, UITabBarItem item)
{
}
}
Any tips for why I'm not seeing this title text I.e. "PROJECTS" showing up in the title bar when I click on the "Projects" tab button?