[英]Presenting viewController with transition is not working
我試圖提供一個視圖控制器,它總是從底部逐漸淡入,並且看起來很奇怪。 無論在此處設置哪種動畫類型,都會發生這種情況。
這是我當前的代碼:
UIViewController *mainV=[self.storyboard instantiateViewControllerWithIdentifier:@"browserViewIP"];
CATransition* transition = [CATransition animation];
transition.duration = 1;
transition.type = kCATransitionFromLeft;
transition.subtype = kCATransitionFromLeft;
[self.view.window.layer addAnimation:transition forKey:kCATransition];
[self presentViewController:mainV animated:YES completion:nil];//also set to NO .
在這里需要一些關於可能出問題的指導。
謝謝。
您應該將動畫直接添加到視圖的圖層,而不是在窗口的圖層上。
更換
[self.view.window.layer addAnimation:transition forKey:kCATransition];
與
[self.view.layer addAnimation:transition forKey:kCATransition];
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.