2012-01-27 7 views
0

私はボタンで、そのボタンtabbarcontrollerをクリックした後、ビューコントローラを持っていた後tabbarcontrollerを取得しますか。?は、プログラム的にそれを行うにはappear.howすべきナビゲーション

アプリは、私はボタンをクリックし、他のビューにナビゲートされた後、それが見えるようにしたいstarted.butされると、私はすぐにショーのタブバーを発見したすべてのチュートリアル。

新しいページがタブバーコントローラで構成する必要がありますように、私は新しいページに移動するためのコードを書きました。

-(IBAction)buttonClicked 
{ 

ViewController *viewController = [[ViewController alloc]initWithNibName:@"view" bundle:nil]; 
     [self.navigationController pushViewController:viewController animated:YES]; 
     [viewController release]; 
} 
+0

は、モーダルビューコントローラを提示し、それを却下私のアプリが開始されると、ユーザが実際にボタン –

+0

をタップしたときにスプラッシュ画面が表示され、その後、 2つのナビゲーションタブバーコントローラが表示されます。 – Sekhar

+0

ヴィンスが示唆何をするか、カスタムTabBarの実装を書くのいずれか。 – samfisher

答えて

0

はこのような何かを試してみてください:

-(IBAction)buttonClicked 
{ 
    UITabBarController *tabBarController = [[UITabBarController alloc] init]; 
    UIViewController *vc1 = [[UIViewController alloc] initWithNibName:@"VC1" bundle:nil]; 
    UITabBarItem *tbi1 = [[UITabBarItem alloc] initWithTitle:@"VC1" image:[UIImage imageNamed:@"vc1"] tag:1]; 
    vc1.tabBarItem = tbi1; 
    // more viewControllers here 

    tabBarController.viewControllers = [NSArray arrayWithObjects:vc1, vc2, vc3, nil]; 
    [self.navigationController pushViewController:tabBarController animated:YES]; 
} 
+0

Thanks.Itsワーキング。 – Sekhar

0

「単一の空のビュー」プロジェクトで始まります。
は、それからちょうどそして、あなたがtabBarItemプロパティに対応するviewControllersにタイトルとアイコンを設定する必要があります(私の頭の上から)

UITabBarController *tbc = [[UITabBarController alloc] init] autorelease]; 
[tbc.view setFrame:self.view.bounds]; 
[tbc setViewControllers:[NSArray arrayWithObjects: viewController1, viewController2, viewController3, nil]]; 
[self.view addSubview:tbv.view]; 

を新しいUITabBarControllerを追加:http://developer.apple.com/library/ios/documentation/uikit/reference/UIViewController_Class/Reference/Reference.html#//apple_ref/occ/instp/UIViewController/tabBarItem

関連する問題