2013-03-25 47 views
0

我有一個應用程序,其中的要求是部分佈局在標籤格式。在其中一個選項卡下,將有一個表格視圖,其中包含細節視圖的細節。當我在標籤導航之外設置此轉換時,它可以工作。但是,當我嘗試在標籤導航中執行此操作時,出現運行時錯誤和崩潰。有沒有一個已知的問題試圖通過一個選項卡加載的segues tableview?與UITableViewController和標籤導航奇怪的行爲

謝謝!薇薇

+0

方法沒有,就是這樣沒有問題。什麼是你得到的運行時錯誤?你的控制器結構是什麼? – rdelmar 2013-03-25 15:39:39

回答

0

以下是對如何使用UITabBarController

一級品創建的UIViewController所有對象和簡單的例子,在AppDelegate.h文件UINavigationController和使用下面的AppDelegate.m

- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions 
{ 
    self.window=[[UIWindow alloc] initWithFrame:[[UIScreen mainScreen] bounds ]]; 

    self.viewCon=[[ViewController alloc] init]; 
    self.navCon=[[UINavigationController alloc] initWithRootViewController:self.viewCon]; 
    self.navCon.navigationBar.tintColor=[UIColor blackColor]; 
    [email protected]"First View"; 

    self.fView=[[FirstViewController alloc] init]; 
    self.FnavCon=[[UINavigationController alloc] initWithRootViewController:self.fView]; 
    self.FnavCon.navigationBar.tintColor=[UIColor blackColor]; 

    [email protected]"Secound View"; 

    self.sView=[[SecoundViewController alloc] init]; 
    self.SnavCon=[[UINavigationController alloc] initWithRootViewController:self.sView]; 
    self.SnavCon.navigationBar.tintColor=[UIColor blackColor]; 
    [email protected]"Third View"; 
    . 
    . 
    // create UIViewController and UINavigationController As you need 
    . 
    . 
    . 
    UIImage *img1=[UIImage imageNamed:@"Australia.gif"]; 
    self.tbItem1=[[UITabBarItem alloc] initWithTitle:@"First Page" image:img1 tag:1]; 
    self.viewCon.tabBarItem=self.tbItem1; 

    UIImage *img2=[UIImage imageNamed:@"Cameroon.gif"]; 
    self.tbItem2=[[UITabBarItem alloc] initWithTitle:@"Secound Page" image:img2 tag:2]; 
    self.fView.tabBarItem=self.tbItem2; 

    UIImage *img3=[UIImage imageNamed:@"Canada.png"]; 
    self.tbItem3=[[UITabBarItem alloc] initWithTitle:@"Third Page" image:img3 tag:3]; 
    self.sView.tabBarItem=self.tbItem3; 

    NSMutableArray *viewArr=[[NSMutableArray alloc] init]; 
    [viewArr addObject:self.navCon]; 
    [viewArr addObject:self.FnavCon]; 
    [viewArr addObject:self.SnavCon]; 


    self.tbCon=[[UITabBarController alloc] init]; 
    self.tbCon.viewControllers=viewArr; 

    [self.window addSubview:tbCon.view]; 

    [self.window makeKeyAndVisible]; 

    return YES; 
} 
+0

我已經成功實現了一個UITabViewController,它適用於我所有的視圖,包括tableviews。所以,這裏是場景:用戶在選項卡上點擊並打開帶有tableview的視圖。用戶點擊tableview中的一個項目,頁面轉換到一個詳細視圖。這是不起作用的功能。只要我沒有拖鞋,所有的標籤都能正常工作。過渡到詳細視圖導致崩潰。當不是標籤視圖的一部分時,相同的功能可以工作 – Pheepster 2013-03-25 14:42:00