1
[我編程方式創建一個標籤欄控制器:標題標籤欄項目沒有顯示
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];
[vc1 release];
[vc2 release];
,如果我的應用程序啓動時加載它,它看起來很棒(請看圖1):
- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions
{
autoMagically = [[AutoMagically alloc] initWithNibName:nil bundle:nil];
//self.window.rootViewController = self.dummyView;
[self.window addSubview:autoMagically.view];
[self.window makeKeyAndVisible];
return YES;
}
,如果我加載一個按鈕被按下時,我想做到這一點,它看起來像圖2看到按鈕如何標題的arent顯示,似乎越來越截止:
- (void)LoadView
{
AutoMagically *autoMagic = [[AutoMagically alloc]
initWithNibName:nil bundle:nil];
self.autoMagically = autoMagic;
[self.view insertSubview:autoMagic.view atIndex:0];
[autoMagic release];
}
有誰知道這是爲什麼表現也是這樣嗎?] 1
繼承人鏈接到圖像顯示代碼正在做什麼。 http://troycomptonworld.com/error/figure3.png –