标签栏上的UIButton

时间:2013-01-21 15:57:51

标签: ios objective-c uibutton uitabbarcontroller uitabbar

在我的应用程序中,我通过单击viewcontroller中的按钮将我的应用程序设置为tabbarcontroller 我想在第三个tabbar按钮的位置添加一个UIButton,怎么做? 我已经按照this教程(可能是最好的) - 但没有得到一个想法

我正在创建像这样的标签栏

在ViewController.h中

   @property (strong,nonatomic) IBOutlet UIViewController *myhomeVC,*groupVC,*uploadVC;
   @property (nonatomic,strong) NSMutableArray *Array;
   @property (strong,nonatomic) IBOutlet UINavigationController *homeNavBar,*groupNavBar,*uploadNavBar;

在ViewController.m

  -(IBAction)Login:(id)sender{




    Array = [[NSMutableArray alloc] initWithCapacity:5];


    myhomeVC = [[FirstViewController alloc] initWithNibName:@"FirstViewController" bundle:nil];
    homeNavBar=[[UINavigationController alloc]initWithRootViewController:myhomeVC];
    homeNavBar.tabBarItem.title=@"First";



    groupVC = [[SecondViewController alloc] initWithNibName:@"SecondViewController" bundle:nil];
    groupNavBar=[[UINavigationController alloc]initWithRootViewController:groupVC];
    groupNavBar.tabBarItem.title=@"Second";

    uploadVC = [[ThirdViewController alloc] initWithNibName:@"ThirdViewController" bundle:nil];
    uploadNavBar=[[UINavigationController alloc]initWithRootViewController:uploadVC];
    uploadNavBar.tabBarItem.title=@"Third";


    [Array addObject:homeNavBar];
    [Array addObject:groupNavBar];
    [Array addObject:uploadNavBar];


    appDelegate.tabBarController.viewControllers = localViewControllersArray;

    [self.parentViewController.view setHidden:YES];



     appDelegate.window.rootViewController = appDelegate.tabBarController;


     }
     }