2011-03-03 48 views
1

我在我的ViewController如何在沒有UINavigationControler的情況下導航到另一個控制器?

- (void)viewDidLoad { 
[super viewDidLoad]; 
UIImageView* view = [[UIImageView alloc] initWithImage: [UIImage imageNamed: @"logo.png"]]; 
view.frame = CGRectMake(300, 200, 200, 350); 
[self.view addSubview:view]; 


UILabel *label = [[UILabel alloc] initWithFrame:CGRectMake(300, 800, 200, 50)]; 
label.textColor = [UIColor blackColor]; 
[label setBackgroundColor:[UIColor clearColor]]; 
[label setFont:[UIFont systemFontOfSize:30]]; 
[label setText: @"Tap to Enter"]; 

[self.view addSubview:label]; 
[label release]; } 

- (void)touchesBegan:(NSSet *)touches withEvent:(UIEvent *)event { 
    NSLog(@"Hello, You Tapped !"); } 

現在我想挖掘並切換到另一個控制器和我想的UITabBarController他們的viewDidLoad以下編碼,我該怎麼辦呢?

如果有人不明確,可能會再次問我

回答

1

您可以調用新的控制器作爲modelviewController ..這是一個選項...並在viewDidLoad的newController init的tabController有..

UIViewController *newViewController = [[UIViewController alloc] init]; 
[self presentModalViewController:newViewController animated:YES]; 

。或者如果你想從右邊到left..You推導航可以動畫從右邊的全新控制器的觀點向左推電流控制器的視野之外到屏幕的左邊..另一種選擇..但我建議第一個...

1

就以攻你應該被導航到另一個控制器的按鈕。寫一個按鈕的方法,並在視圖加載方法的新控制器,啓動tabbarcontroller

相關問題