使用標簽欄控制器iphone iOS5

[英]Using Tab Bar Controllers iphone iOS5


Im using the new storyboarding features with ios. I have a tab bar which also has a class name called mytabbarcontroller. However I do not have a seperate class for this as in a .h/.m file for this since all its implementation is in different views which is sorted. Now i have a view controller which appears before the tab bar with an activity indicator. Once it stops it has to move to the tab bar controller. However i cant initialise it with mytabbarcontroller since i dont have .h files to import. Currently it goes to a tab bar controller with nothing on it - basically it creates a new tab bar controller. My code is as follow. I also tried initwithnibname and gave the nib name - i.e mytabbarcontroller. However this throws an error.

我使用ios的新故事板功能。我有一個標簽欄,它還有一個名為mytabbarcontroller的類名。但是我沒有像這樣的.h / .m文件中的單獨類,因為它的所有實現都在不同的視圖中進行排序。現在我有一個視圖控制器出現在標簽欄之前,帶有一個活動指示器。一旦停止,它必須移動到標簽欄控制器。但是我不能用mytabbarcontroller初始化它,因為我沒有要導入的.h文件。目前它進入一個沒有任何內容的標簽欄控制器 - 基本上它創建了一個新的標簽欄控制器。我的代碼如下。我也試過initwithnibname並給出了筆尖名稱 - 即mytabbarcontroller。但是這會引發錯誤。

UITabBarController *controller = (UITabBarController *)[[UITabBarController alloc] init ];
controller.modalTransitionStyle = UIModalTransitionStyleFlipHorizontal;
[self presentModalViewController:controller animated:YES];

1 个解决方案

#1


1  

because you are declaring a new UITabBarController, try this instead, import and intialize the first view of the tab bar, for example

因為你正在聲明一個新的UITabBarController,試試這個,導入並初始化標簽欄的第一個視圖,例如

FirstSceneController.h

import "FirstTabViewController.h"

...

FirstTabViewController *firstTab = [self.storyboard instantiateViewControllerWithIdentifier:@"mytabbarcontroller"]; [firstTab setModalTransitionStyle:UIModalTransitionStyleCoverVertical]; [self presentModalViewController:firstTab animated:YES];

FirstTabViewController * firstTab = [self.storyboard instantiateViewControllerWithIdentifier:@“mytabbarcontroller”]; [firstTab setModalTransitionStyle:UIModalTransitionStyleCoverVertical]; [self presentModalViewController:firstTab animated:YES];

.... and also be sure to add a navigation controller and connect it to your first scene.

....並且還要確保添加導航控制器並將其連接到您的第一個場景。


注意!

本站翻译的文章,版权归属于本站,未经许可禁止转摘,转摘请注明本文地址:https://www.itdaan.com/blog/2011/10/20/1d9348df7628bc3c832e77f94e4c283a.html



 
  © 2014-2022 ITdaan.com 联系我们: