1
我使用一個自定義的賽格瑞它看起來像這樣不按預期工作:的iOS:定製賽格瑞和presentViewController
@implementation ModalPushSegue
- (void)perform {
UIViewController *fromController = self.sourceViewController;
UIViewController *toController = self.destinationViewController;
UIView *fromView = fromController.view;
UIView *toView = toController.view;
CGPoint centerStage = toView.centerStage;
toView.center = toView.rightStage;
[fromView.window addSubview:toView];
[fromController addChildViewController:toController];
[UIView transitionWithView:toView
duration:0.5 options:0
animations:^{
toView.center = centerStage;
}
completion:nil];
}
這是行之有效的觀點是幻燈片從正如預期的那樣,控制器被添加到控制器層次結構中。
但後來在添加控制器我這樣做:
[self presentViewController:anotherController animated:YES completion:nil];
我希望它可以有新的控制器視圖的畫面翼式的模式向上滑動。但是,會發生什麼情況是新視圖不會出現。當我稍後移除此控制器時,它的視圖會閃爍並從屏幕上滑落,留下黑色背景,而不是最初存在的視圖。
我一直在玩弄這一段時間,如果我更改代碼以
//[self presentViewController:oauthController animated:YES completion:nil];
[self.view addSubview:oauthController.view];
[self addChildViewController:oauthController];
然後如預期,雖然沒有出現調整的觀點。
我的問題似乎是與segues設置層次結構的方式相比,presentViewController
做的事情。我已經做了大量的閱讀和搜索,但到目前爲止還沒有能夠清楚地瞭解到底發生了什麼。
我也玩過在segue中使用presentViewController
,但沒有鋪設舊的視圖,屏幕變黑,然後新的視圖滑動。
任何幫助表示讚賞。