It is common design pattern that most mobile app use
+-------------------------+
| title |
+-------------------------+
| |
| |
| |
| |
| |
| |
| content |
| |
| |
| |
| |
| |
+-------------------------+
| |tab1| |tab2| |tab3| |
+-------------------------+
The main idea is when user press tab1 or tab2 or tab3 the content will change accordingly.
What I am doing that now(with code not storyboard) is that make a ViewController
to show the content and the bottom panel and make a UINavigationController
to display the title
- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions {
self.window = [[UIWindow alloc] initWithFrame:[[UIScreen mainScreen] bounds]];
ViewController *viewController = [[ViewController alloc] init];
UINavigationController *nav = [[UINavigationController alloc] initWithRootViewController:viewController];
self.window.rootViewController = nav;
[self.window makeKeyAndVisible];
}
and when user press bottom tab change the content view while changing the content with subviews
, but I found that when changing the content I found that:
- the view will not start properly margined with the height of title.
- furthermore, I should write all the logic in the same view controller which will cause the code a mess.
How to implement such a layout?