UI_A Demo Of WeChat

- (void)viewDidLoad {
    [super viewDidLoad];
    // Do any additional setup after loading the view.

    // 1. 创建微信控制器
    WeChatTableViewController *weChatTVC = [[WeChatTableViewController new] autorelease];
    weChatTVC.title = @"WeChat";
    UINavigationController *weChatNC = [[[UINavigationController alloc] initWithRootViewController:weChatTVC] autorelease];
    weChatNC.tabBarItem = [[[UITabBarItem alloc] initWithTitle:@"WeChat" image:[UIImage imageNamed:@"tabbar_mainframe"] tag:100] autorelease];


    // 2. Contacts

    ContactsTableViewController *contactsTVC = [[ContactsTableViewController new] autorelease];
    contactsTVC.title = @"Contacts";
    UINavigationController *contactsNC = [[[UINavigationController alloc] initWithRootViewController:contactsTVC] autorelease];
    contactsNC.tabBarItem = [[[UITabBarItem alloc] initWithTitle:@"Contacts" image:[UIImage imageNamed:@"tabbar_contacts"] tag:101] autorelease];



    // 3. Discover

    DiscoverTableViewController *discoverTVC = [[DiscoverTableViewController new] autorelease];
    discoverTVC.title = @"Discover";
    UINavigationController *discoverNC = [[[UINavigationController alloc] initWithRootViewController:discoverTVC] autorelease];
    discoverNC.tabBarItem = [[UITabBarItem alloc] initWithTitle:@"Discover" image:[UIImage imageNamed:@"tabbar_discover"] tag:102];


    // 4. Me
    MeTableViewController *meTVC = [[MeTableViewController new] autorelease];
    meTVC.title = @"Me";
    UINavigationController *meNC = [[[UINavigationController alloc] initWithRootViewController:meTVC] autorelease];
    meNC.tabBarItem = [[UITabBarItem alloc] initWithTitle:@"Me" image:[UIImage imageNamed:@"tabbar_me"] tag:103];



    // 5. 添加
    self.viewControllers = @[weChatNC, contactsNC, discoverNC, meNC];

}
- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions {
    // Override point for customization after application launch.
#pragma mark - 设置window
    self.window = [[[UIWindow alloc] initWithFrame:[UIScreen mainScreen].bounds] autorelease];
    self.window.backgroundColor = [UIColor whiteColor];
    [self.window makeKeyAndVisible];


#pragma mark - 设置根视图控制器
    RootViewController *rootTBC = [[RootViewController new] autorelease];
    self.window.rootViewController = rootTBC;

    // 设置所有的UINavigationBar的选染色
    [UINavigationBar appearance].barTintColor = [UIColor colorWithWhite:0.347 alpha:1.000];


    return YES;
}
  1. UITabBarController
  2. UITabBarItem

  3. 继承UITabBarController,在里面添加了子控制器

  4. AppIcon

  5. LaunchImage
  6. 应用程序名称

  7. Block传值(从后往前传)
    7.1 block属性,需要使用Copy(从栈区拷贝到堆区一份,自己管理block变量的内存)
    7.2 在block内部,不使用self,防止‘循环引用’的发生。解决方案:__block

  8. 总结

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值