我想寫一個自定義賽格瑞和所遇到的這個錯誤不平衡通話開始爲/終端外形的轉變:在<UIViewController中0x176c0bd0>導航控制器
不平衡通話開始/結束的外觀轉變爲的UIViewController:0x176c0bd0
幫助按鈕連接到幾乎是空的ViewController - 和退出按鈕解開SEGUE
所有的控制器AR嵌入在導航控制器中。
我已經閱讀了各種帖子,在這裏人們遇到同樣的問題,但解決方案變化很大,我仍然沒有找到合適的解決方案。我認爲這是因爲我在導航控制器中調用了自定義的segue,但是我的代碼沒有反映出這一點。我已經按照本教程中創建自定義SEGUE http://blog.dadabeatnik.com/2013/10/13/custom-segues/
初始控制器具有以下方法:
- (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender
{
if([segue isKindOfClass:[ICIHelpSegue class]]) {
((ICIHelpSegue *)segue).originatingPoint = self.help.center;
}
}
- (IBAction)unwindFromViewController:(UIStoryboardSegue *)sender {
}
- (UIStoryboardSegue *)segueForUnwindingToViewController:(UIViewController *)toViewController fromViewController:(UIViewController *)fromViewController identifier:(NSString *)identifier {
ICIUnwindHelpSegue *segue = [[ICIUnwindHelpSegue alloc] initWithIdentifier:identifier source:fromViewController destination:toViewController];
segue.targetPoint = self.help.center;
return segue;
}
的ICIHelpSegue類是如下界面:
@interface ICIHelpSegue : UIStoryboardSegue
@property CGPoint originatingPoint;
@property CGPoint targetPoint;
@end
和實現文件看起來像這樣:
@implementation ICIHelpSegue
- (void)perform {
UIViewController *sourceViewController = self.sourceViewController;
UIViewController *destinationViewController = self.destinationViewController;
UINavigationController *navigationController = sourceViewController.navigationController;
[navigationController.view addSubview:destinatiionViewController.view]
// Transformation start scale
destinationViewController.view.transform = CGAffineTransformMakeScale(0.05, 0.05);
// Store original centre point of the destination view
CGPoint originalCenter = destinationViewController.view.center;
// Set center to start point of the button
destinationViewController.view.center = self.originatingPoint;
[UIView animateWithDuration:0.5
delay:0.0
options:UIViewAnimationOptionCurveEaseInOut
animations:^{
// Grow!
destinationViewController.view.transform = CGAffineTransformMakeScale(1.0, 1.0);
destinationViewController.view.center = originalCenter;
}
completion:^(BOOL finished){
[destinationViewController.view removeFromSuperview]; // remove from temp super view
[navigationController presentViewController:destinationViewController animated:NO completion:NULL]; // present VC
}];
}
@end
任何ide爲什麼會出現這種錯誤?這是什麼意思?以及如何解決它?
只是一個想法。你嘗試刪除這一行:'[sourceViewController presentViewController:destinationViewController animated:NO completion:NULL];'??? – lucaslt89 2014-10-10 15:16:07
是的,但沒有幫助。但我已經找到了一種消除錯誤的方法 - 我聲明瞭UINavigationController * navigationController = sourcerViewController.navigationController;然後,我做[navigationController.view addSubview:destinationViewController]然後在完成塊我調用[navigationController.view removeFromSuperview]這擺脫了錯誤,但它看起來不是很好,所以我留下的問題,看看如果有人能告訴我更好的解決方案,或者幫我弄清楚發生了什麼。我對此很陌生,只會猜測一半的時間。 – 2014-10-10 15:24:03
我們需要看看故事板如何連接。你能發佈你的故事板segues連接的截圖嗎? – lucaslt89 2014-10-10 15:28:30