问题描述
我使用UIModalPresentationFormSheet的modalPresentationStyle来显示我的视图.我想要视图的特定大小,因此使用preferredContentSize在iOS 8中工作的preferredContentSize,并显示了我想要的方式,但对于iOS 7它会随着完整的表格而变化.尺寸更改.
我想要的地方如下图
有什么想法吗?
推荐答案
请检查以下iOS 8.x和iOS 7
的条件代码if (SYSTEM_VERSION_GREATER_THAN_OR_EQUAL_TO(@"8.0")) { modalController.preferredContentSize = CGSizeMake(frameSize.x, frameSize.y); } else { modalController.view.superview.frame = CGRectMake((screenWidth - frameSize.x)/2, (screenHeight - frameSize.y)/2, frameSize.x, frameSize.y); }
希望这对您有帮助.
问题描述
I am using modalPresentationStyle of type UIModalPresentationFormSheet to show my view.I want specific size of the view so using preferredContentSize which working in iOS 8 and showing exact how I wanted but same breaks for iOS 7 it's come as full sheet.View size changed.
Where as I wanted like below image
Any idea?
推荐答案
Please check below conditional code for iOS 8.x and iOS 7
if (SYSTEM_VERSION_GREATER_THAN_OR_EQUAL_TO(@"8.0")) { modalController.preferredContentSize = CGSizeMake(frameSize.x, frameSize.y); } else { modalController.view.superview.frame = CGRectMake((screenWidth - frameSize.x)/2, (screenHeight - frameSize.y)/2, frameSize.x, frameSize.y); }
Hope this will help you.
相关问答
setSelectedImageTintColor在iOS7中不起作用
UISearchBar的自定义InputView在iOS7中不起作用
UITabBar外观setSelectionIndicatorImage在首次启动iOS7时不起作用
为什么UISwitch的onImage/offImage属性在iOS7上不起作用?
iOS 7中的静默推送通知不起作用
为什么tintColor在iOS7的导航栏和工具栏上不起作用?
为什么tintColor在iOS7的导航栏和工具栏上不起作用?
在ios7中从应用切换器中杀死应用时,静默推送不起作用
UISearchBar'的取消和清除按钮在iOS 7中不起作用
背景位置服务在iOS 7中不起作用