簡體   English   中英

UIStoryboardSegue和UIVisualEffectView-完成塊退出后迷離效果丟失

[英]UIStoryboardSegue & UIVisualEffectView - Blur effect lost after completion block exits

我有一個小的應用程序,其中包含帶有UIImageView的視圖控制器。 當用戶點擊屏幕時,將顯示具有自定義過渡的Tableview控制器(模型)。 過渡將UIBlurEffectview添加到呈現的tableview中。 理想的效果是在模糊圖像上顯示UITableView。

呈現表格視圖時,它會瞬間顯示模糊視圖。 但是,一旦完成塊退出(在presentViewController:animated:completion上),視圖就會變成全黑。

完成塊退出之前的示例: 在此處輸入圖片說明

完成塊退出后: 在此處輸入圖片說明

這是segue代碼:

UIViewController *sourceController = self.sourceViewController;
UIViewController *destinationController  = self.destinationViewController;


UIVisualEffect *blurEffect = [UIBlurEffect effectWithStyle:UIBlurEffectStyleDark];
UIVisualEffectView *blurView = [[UIVisualEffectView alloc]initWithEffect:blurEffect];
blurView.frame = destinationController.view.frame;


[destinationController.view setOpaque:NO];
[destinationController.view setBackgroundColor:[UIColor clearColor]];
[destinationController.view insertSubview:blurView atIndex:0];
[destinationController setModalPresentationStyle:UIModalPresentationFullScreen];

[sourceController presentViewController:destinationController animated:NO completion:^{
    NSLog(@"Completed");
}];

我有點想去哪里,我知道在完成控制器被調用之前的最后一個調用是所提供控制器上的viewDidAppear,那就是什么都沒有改變。 任何幫助是極大的贊賞。

找到了解決方案。 如果您使用的是Modal segue,則需要將演示文稿從默認設置為全屏顯示。

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM