【发布时间】:2011-09-16 15:25:20
【问题描述】:
图 1 显示了在应用程序启动时加载的动态创建的标签栏控制器:
- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions
{
autoMagically = [[AutoMagically alloc] initWithNibName:nil bundle:nil];
[self.window addSubview:autoMagically.view];
[self.window makeKeyAndVisible];
return YES;
}
如果我通过单击视图上的按钮来加载它(我想要并且需要这样做的方式),我会得到上图图 2 所示的内容:
-(void) loadWhenClicked{
AutoMagically *todaysDeal = [[AutoMagically alloc] initWithNibName:nil bundle:nil];
todaysDeal.modalTransitionStyle = UIModalTransitionStyleCoverVertical;
[self presentModalViewController:todaysDeal animated:YES];
[todaysDeal release];
}
这是我创建标签栏的代码:
tabBarController = [[UITabBarController alloc] init];
FirstViewController* vc1 = [[FirstViewController alloc] init];
SecondViewController* vc2 = [[SecondViewController alloc] init];
vc1.title = @"Dallas";//[[NSUserDefaults standardUserDefaults] objectForKey:@"Citynamefrmhome"];
vc1.tabBarItem.image = [UIImage imageNamed:@"Dealss.png"];
vc2.title = @"My Vouchers";
vc2.tabBarItem.image = [UIImage imageNamed:@"nav_voucher_S.png"];
NSArray* controllers = [NSArray arrayWithObjects:vc1,vc2, nil];
tabBarController.viewControllers = controllers;
[self.view addSubview:tabBarController.view];
当我像其他视图一样加载标签栏控制器时,如何使标签栏控制器正确显示,如图 1 所示? 这是一个使用 xcode 4 的基于 iphone 视图的应用程序。
【问题讨论】:
-
我的意思是 troycomptonworld.com/error/figure3.png 对此感到抱歉
标签: objective-c ios4 xcode4