如何在当前上下文中呈现模糊背景的UITableViewController作为表单?
- (void)viewDidLoad {
self.tableView.backgroundColor = [UIColor clearColor];
self.tableView.backgroundView = [[UIVisualEffectView alloc] initWithEffect:[UIBlurEffect effectWithStyle:UIBlurEffectStyleLight]];
}
在使用UIModalPresentationOverCurrentContext
但对于iPad,如果我想将其显示为表单,则需要将modalPresentationStyle
设置为UIModalPresentationFormSheet
。
如何设置两者?
答案 0 :(得分:0)
我发现我需要UIModalPresentationPopover
使用modalPresentationStyle
,然后您可以将视图控制器popoverPresentationColor
设置为clearColor
。
FAGalleryTableViewController *vc = (FAGalleryTableViewController *)[segue destinationViewController];
if ( UI_USER_INTERFACE_IDIOM() == UIUserInterfaceIdiomPad ) {
vc.modalPresentationStyle = UIModalPresentationPopover;
vc.popoverPresentationController.sourceView = _storeButton;
vc.popoverPresentationController.backgroundColor = [UIColor clearColor];
vc.popoverPresentationController.permittedArrowDirections = UIPopoverArrowDirectionDown;
vc.modalTransitionStyle = UIModalTransitionStyleCoverVertical;
}
答案 1 :(得分:0)
经过如此多的搜索,这对iOS10 +
起作用了if (UI_USER_INTERFACE_IDIOM() == UIUserInterfaceIdiomPad){
//IPAD
CamVC *destination = segue.destinationViewController;
[destination setModalPresentationStyle:UIModalPresentationFullScreen];
[destination setModalTransitionStyle:UIModalTransitionStyleCrossDissolve];
}else{
// IPHONE
CamVC *destination = segue.destinationViewController;
destination.modalPresentationStyle = UIModalTransitionStyleCrossDissolve;
destination.modalTransitionStyle = UIModalTransitionStyleCrossDissolve;
}