首页 > 代码库 > 手机QQ底部分栏效果【标签栏】
手机QQ底部分栏效果【标签栏】
AppDelegate.m
// // AppDelegate.m // Task5 // // Created by lyb on 14-9-27. // Copyright (c) 2014年 imac. All rights reserved. // #import "AppDelegate.h" #import "FirstViewController.h" #import "SecondViewController.h" @implementation AppDelegate - (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions { self.window = [[UIWindow alloc] initWithFrame:[[UIScreen mainScreen] bounds]]; // Override point for customization after application launch. self.window.backgroundColor = [UIColor whiteColor]; [self.window makeKeyAndVisible]; FirstViewController *firstCtrl = [[FirstViewController alloc] init]; SecondViewController *secondCtrl =[[SecondViewController alloc] init]; UINavigationController *navCtrl1 = [[UINavigationController alloc] initWithRootViewController:firstCtrl]; UINavigationController *navCtrl2 = [[UINavigationController alloc] initWithRootViewController:secondCtrl]; UITabBarController *tabbarCtrl = [[UITabBarController alloc] init]; tabbarCtrl.viewControllers = @[navCtrl1, navCtrl2]; self.window.rootViewController = tabbarCtrl; return YES; } @end
FirstViewController.m
- (void)viewDidLoad { [super viewDidLoad]; self.title = @"左"; self.view.backgroundColor = [UIColor redColor]; }
SecondViewController.m
#import "SecondViewController.h" #import "ThirdViewController.h" @interface SecondViewController () @end @implementation SecondViewController - (id)initWithNibName:(NSString *)nibNameOrNil bundle:(NSBundle *)nibBundleOrNil { self = [super initWithNibName:nibNameOrNil bundle:nibBundleOrNil]; if (self) { self.title = @"右"; } return self; } - (void)viewDidLoad { [super viewDidLoad]; self.view.backgroundColor = [UIColor greenColor]; UIButton *button = [UIButton buttonWithType:UIButtonTypeContactAdd]; button.frame = CGRectMake(90, 90, 90, 50); [button addTarget:self action:@selector(buttonAction) forControlEvents:UIControlEventTouchUpInside]; [self.view addSubview:button]; } - (void)buttonAction { ThirdViewController *thirdCtrl = [[ThirdViewController alloc] init]; [self.navigationController pushViewController:thirdCtrl animated:YES]; }
ThirdViewController.m
- (id)initWithNibName:(NSString *)nibNameOrNil bundle:(NSBundle *)nibBundleOrNil { self = [super initWithNibName:nibNameOrNil bundle:nibBundleOrNil]; if (self) { //隐藏标签栏工具栏 self.hidesBottomBarWhenPushed = YES; } return self; } - (void)viewDidLoad { [super viewDidLoad]; self.view.backgroundColor = [UIColor orangeColor]; self.title = @"三"; }
手机QQ底部分栏效果【标签栏】
声明:以上内容来自用户投稿及互联网公开渠道收集整理发布,本网站不拥有所有权,未作人工编辑处理,也不承担相关法律责任,若内容有误或涉及侵权可进行投诉: 投诉/举报 工作人员会在5个工作日内联系你,一经查实,本站将立刻删除涉嫌侵权内容。