开发者

How to add tab bar programatically

开发者 https://www.devze.com 2023-01-29 15:27 出处:网络
I hidden my first tab bar,and now i want to add another tab bar in my next view.Pleas开发者_如何学Goe help me in this to write the code programaticallyUITabBarController *tabView=[[UITabBarController

I hidden my first tab bar,and now i want to add another tab bar in my next view.Pleas开发者_如何学Goe help me in this to write the code programatically


UITabBarController *tabView=[[UITabBarController alloc] init];
tabView.view.frame=CGRectMake(0,0,screenRect.size.width, screenRect.size.height);
NSMutableArray *arrToAddView =[[NSMutableArray alloc]init];//array to store tab's view 

    for (int i=0;i<5;i++) 
    {
UIViewController *viewForTab = [[UIViewController alloc] init];
viewForTab.view.backgroundColor = [UIColor whiteColor];
[arrToAddView addObject:viewForTab];

    }           
[tabView setViewControllers:arrToAddView];
[self.view addSubview:tabView.view];
0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号