1

で作業していません...私のアプリは、私は、IOSの新しいバージョンのために自分のアプリケーションで5番目のものを苦労していiOS5を

私は通常、アプリケーションを起動することができますが、私はタブバーのアイテムまたは上のクリックしたときボタンがクラッシュします。例外のコードとそれが実行できるビューのコードを書きます:)

これはすべてのターゲットで機能しますが、ios5ではクラッシュします。何か案が? *

キャッチされない例外により 'UIViewControllerHierarchyInconsistency' にアプリを終了、理由: '子ビュー コントローラは:親ビュー コントローラを持っている必要がありますが、実際の親 です:'

@implementation PortCIAViewController 
@synthesize tabBarController,topHeader,myApp; 

- (void)viewDidLoad { 
    [super viewDidLoad]; 
    tabBarController.view.frame = CGRectMake(0, 30, 320, 430); 
    [self.view addSubview:tabBarController.view]; 
    //self.view = tabBarController.view; 
} 

- (void)tabBarController:(UITabBarController *)tabBarControllerA didSelectViewController:(UIViewController *)viewController{ 
    if(tabBarControllerA.selectedIndex==4){ 
     [(PortCIAAppDelegate*)myApp activeFullScreen]; 
     if(([(OrariViewController *)viewController segmentControllOrari].selectedSegmentIndex)==-1){ 
      [(OrariViewController *)viewController segmentControllOrari].selectedSegmentIndex=0; 
      [(OrariViewController *)viewController segmentControllFascie].selectedSegmentIndex=[OrariViewController getCorrectFasciaOraria]; 
     } 
    } 
    else{ 
     [(PortCIAAppDelegate *)myApp deactiveFullScreen]; 
    } 

} 

- (void)dealloc { 
    [tabBarController release]; 
    [myApp release]; 
    [topHeader release]; 
    [super dealloc]; 
} 

@end 

答えて

3

簡単な答えは、あるビューコントローラから別のビューコントローラにビューを挿入するのが間違っていることです。私はthis answer

+0

@interfaceのSettingsViewControllerに提案するよう

長い答えはUITabBarControllerからではなく、のUIViewControllerからこのビューコントローラを導出することである:UITabBarController virata

関連する問題