【发布时间】:2012-11-04 07:38:58
【问题描述】:
我在 UIViewController 中创建了一个 UIScrollView 。现在我想向它添加一个 UITabBarController 。但是当我这样做时,我看不到 TabBarController 添加到它..
我已经写了这段代码
[testscroll setScrollEnabled:YES];
[testscroll setContentSize:CGSizeMake(320,800)];
FirstViewController *first = [[FirstViewController alloc] initWithNibName:@"FirstViewController" bundle:nil];
first.title=@"Search";
UserProfile *second=[[UserProfile alloc]initWithNibName:@"UserProfile" bundle:nil];
second.title=@"My Profile";
UserActivities *third=[[UserActivities alloc]initWithNibName:@"UserActivities" bundle:nil];
third.title=@"My Activities";
LogOut *logout=[[LogOut alloc]initWithNibName:@"LogOut" bundle:nil];
logout.title=@"Sign Out";
NSArray *viewArray= [NSArray arrayWithObjects:first,second,third,logout, nil];
tabBarController=[[UITabBarController alloc] init];
[tabBarController setViewControllers:viewArray animated:NO];
[self presentModalViewController:tabBarController animated:NO];
我在第五个ViewController 中添加了这个。我可以看到添加了 UIScrollView 和一些标签和文本字段,但没有添加 TabBarController。我哪里出错了..?
【问题讨论】:
标签: iphone objective-c cocoa-touch uiscrollview uitabbarcontroller