各位大神,我想知道UITabBarController如何工作,谁能告诉我么?
中级工程师 2# dengbing 发表于 2012-2-23 11:36:50
  1. @interface RootViewController : UIViewController {
  2.     UIViewController *currentVC;
  3. }
  4. -(void) destroyCurrent;
  5. -(void) switchToViewController: (int) controller;
  6. -(void) switchToViewController: (int) controller {
  7.     [self destroyCurrent];
  8.     switch (controller) {
  9.         case 0:
  10.             MyViewController *viewController = [[MyViewController alloc] init];
  11.             currentVC = viewController;
  12.             break;
  13.         //case 1: ...
  14.         default:
  15.             break;
  16.     }
  17.     [self.view addSubview:currentVC.view];
  18. }
  19. -(void) destroyCurrent {
  20.     if (currentVC) {
  21.         [currentVC.view removeFromSuperview];
  22.         [currentVC release];
  23.         currentVC = nil;
  24.     }
  25. }
复制代码
研究员 3# wkf9924 发表于 2012-2-23 12:19:04
版主 4# RealTool 发表于 2012-2-23 23:48:32
创建tabbarcontroller,设置viewcontrollers,然后使用。
中级工程师 5# wlzwcr 发表于 2012-3-8 21:59:59
又看不懂~~~
您需要登录后才可以回帖 登录 | 注册

关于我们|手机版|Archiver|DEVDIV.COM ( 京ICP备07040843号 )  

GMT+8, 2012-5-19 17:37

Powered by DEVDIV.COM!

© 2010-2012 DEVDIV.COM Coummunity.

回顶部