大佬教程收集整理的这篇文章主要介绍了objective-c – 具有ModalPresentationStyle的Popover并不以iOS 7 iPad为中心,大佬教程大佬觉得挺不错的,现在分享给大家,也给大家做个参考。
@H_645_8@myViewController *myVC = [[myViewController alloc] init]; UINavigationController *nav = [[UINavigationController alloc] initWithRootViewController:myVC]; [nav setModalPresentationStyle:UIModalPresentationFormSheet]; [nav setModalTransitionStyle: UIModalTransitionStyleFlipHorizontal]; [self presentViewController:nav animated:YES completion:nil]; nav.view.superview.bounds = CGRectMake(0,320,465);
在iOS 6中都可以正常工作,但在iOS 7中它并没有集中。
但是如果我将ModalTransitionStyle设置为UIModalTransitionStyleCrossDissolve它可以正常工作。但只能在这种模式下。
也许有人绊倒了这个,知道如何解决它?我不是溶解效应的大粉丝。
谢谢。
- (void) hackmodalSheetSize:(CGSizE) aSize ofVC:(UIViewController *) aController; { void (^formSheetBlock) (void) = ^{ int preferredWidth = aSize.width; int preferredHeight = aSize.height; CGRect frame = CGRectMake((int) 1024/2 - preferredWidth/2,(int) 768/2 - preferredHeight/2,preferredWidth,preferredHeight); aController.view.superview.frame = frame; if([aController respondsToSELEctor:@SELEctor(edgesForExtendedLayout)]) { //ios7 aController.view.superview.BACkgroundColor = [UIColor clearColor]; } else { // < ios7 UIImageView *BACkgroundView = [aController.view.superview.subviews objectATindex:0]; [BACkgroundView removeFromSuperview]; } }; //on ios < 7 the animation would be not as smooth as on the older versions so do it immediately if(![self respondsToSELEctor:@SELEctor(edgesForExtendedLayout)]) { formSheetBlock(); return; } double delayInSeconds = .05; dispatch_time_t popTime = dispatch_time(DISPATCH_TIME_Now,delayInSeconds * NSEC_PER_SEC); dispatch_after(popTime,dispatch_get_main_queue(),^(void){ formSheetBlock(); }); }
以上是大佬教程为你收集整理的objective-c – 具有ModalPresentationStyle的Popover并不以iOS 7 iPad为中心全部内容,希望文章能够帮你解决objective-c – 具有ModalPresentationStyle的Popover并不以iOS 7 iPad为中心所遇到的程序开发问题。
如果觉得大佬教程网站内容还不错,欢迎将大佬教程推荐给程序员好友。
本图文内容来源于网友网络收集整理提供,作为学习参考使用,版权属于原作者。
如您有任何意见或建议可联系处理。小编QQ:384754419,请注明来意。