我提出一個包含UIVisualEffectView如下一個UIViewController:UIVisualEffectView在iOS的10
-(void)collectionView:(UICollectionView *)collectionView didSelectItemAtIndexPath:(NSIndexPath *)indexPath {
[self performSegueWithIdentifier:@"segueBlur" sender:nil];
}
-(void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender {
if([segue.identifier isEqualToString:@"segueBlur"]) {
((UIViewController *)segue.destinationViewController).providesPresentationContextTransitionStyle = YES;
((UIViewController *)segue.destinationViewController).definesPresentationContext = YES;
((UIViewController *)segue.destinationViewController).modalPresentationStyle = UIModalPresentationOverFullScreen;
}
}
正如你所看到的,我使用的是UIModalPresentationStyleOverFullScreen使之與模糊視圖控制器出現時,模糊會被「應用」到呈現它的視圖控制器的內容; segue具有Cross Dissolve轉換風格。
效果與預期相符。然而,在iOS 9中,演示文稿比在iOS 10中更流暢。在iOS 10中,當視圖控制器出現時,它看起來像是兩步動畫,而在iOS 9中,模糊立即應用。
一張圖片勝過千言萬語,所以我上傳出這種奇怪的行爲視頻:
UIVisualEffectView iOS 9 vs iOS 10
我的問題是:如何在iOS的10呈現視圖控制器,因爲它是iOS中呈現9?
太棒了!很棒。我使用了我用於發佈的視頻的同一個項目,並將其上傳到GitHub並提供瞭解決方案。謝謝。 > https://github.com/Axort/BlurTest-iOS10 – Axort
我建議使用彈簧動畫,持續時間爲0.5。這是本地人所做的。 –
@Axort你有一個迅速的版本? – user2722667