Created
February 22, 2012 05:04
-
-
Save nicwise/1881577 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//most of the non-declared variables here are at the class level - eg window is: | |
// UIWindow window | |
// etc. | |
window = new UIWindow (UIScreen.MainScreen.Bounds); | |
UIApplication.SharedApplication.StatusBarStyle = UIStatusBarStyle.BlackOpaque; | |
tabBar = new UITabBarController(); | |
MainView = tabBar.View; | |
//make some DialogViewController's - I descend various classes off them | |
summary = new OverviewDialogViewController(); | |
records = new RecordsDialogViewController(); | |
deadlines = new DeadlinesDialogViewController(); | |
export = new ExportDialogViewController(); | |
tabControllers = new UINavigationController[] { | |
new UINavigationController(summary) { | |
TabBarItem = new UITabBarItem("Overview", Resources.Overview, 0) | |
}, | |
new UINavigationController(records) { | |
TabBarItem = new UITabBarItem("Records", Resources.Records, 1) | |
}, | |
new UINavigationController(deadlines) { | |
TabBarItem = new UITabBarItem("Deadlines", Resources.Deadlines, 2) | |
}, | |
new UINavigationController(export) { | |
TabBarItem = new UITabBarItem("Export", Resources.Export, 3) | |
} | |
}; | |
tabBar.SetViewControllers(tabControllers, false); | |
tabBar.ViewControllerSelected += delegate(object sender, UITabBarSelectionEventArgs e) { | |
if (tabBar.SelectedIndex == 0) | |
{ | |
(summary as OverviewDialogViewController).ReloadSummary(null); | |
} | |
}; | |
window.RootViewController = tabBar; | |
window.MakeKeyAndVisible (); |
Hi Nic,
Thanks for this example. The only bit I don't understand is:
MainView = tabBar.View;
Where does MainView come from, or where is it supposed to be declared?
Cheers!
@ArnoldKrimins - no, they are just DialogViewController descendants, which is specific to the (client) application. Basically just a UITableViewController.
@Shogan: I think this might be old, dead code. You used to have to keep track of things a bit more aggressively in MonoTouch than you do now, to avoid being GC'ed. I doubt there is any need for it.
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Hi do you have the full code listing for this? Specifically the classes?
summary = new OverviewDialogViewController();
records = new RecordsDialogViewController();
deadlines = new DeadlinesDialogViewController();
export = new ExportDialogViewController();