2015-04-16 28 views
0

我試圖從一個UIViewController移動其他使用-pushViewController:animated使用非常緩慢的下方剪斷:使用pushViewController是在iPad上

SomeController *tabBar = [self.storyboard instantiateViewControllerWithIdentifier:@"mycus"]; 

[self.navigationController pushViewController:tabBar animated:YES]; 

從一個UIViewController移動(沒有UIViews或圖像)有3移動前第二次延遲。什麼導致這個問題,我將如何解決它?

+0

爲什麼不使用segue? –

+1

當你打這個電話時,你是否在後臺線程/隊列中? –

+0

@rckoenes因此,在他的代碼中,如果它不是故事板,那麼這意味着什麼...? [self.storyboard instantiateViewControllerWithIdentifier:@「mycus」]; ??? –

回答

0

對於故事板,請單擊您創建的segue,併爲其指定一個標識,如「someSegue」。

接下來你將要觸發你的ViewController的prepareForSegue委託執行以下操作...

[self performSegueWithIdentifier:@"SomeSegue" sender:nil]; 

..Then你將要在您的視圖控制器的委託方法,做任何準備,你可能在下一個視圖控制器被初始化之前需要。

-(void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender { 

SomeController *vc = [segue destinationViewController]; 

// Here you will want to do your prep e.g. pass iVars etc from one controller to the other. 

} 
+0

我試過了上面的代碼。但是我有目的viewcontroller包含大量的uiviews在這種情況下,只有它延遲移動。請告知這個。謝謝! – newbee

+0

你的問題是UIViews的數量,如果你發佈你的代碼,可能還有另一種解決方法你的故事板的圖片。 –

+0

我現在無法分享故事板詳情。但是我可以提供關於我的目標控制器的詳細信息 - 其中包含三個選項卡,每個選項卡都沒有在故事板中設計的UIView和相應制約的UIView。你現在可以建議如何解決這種情況嗎? – newbee

相關問題