preferredContentSize not working in ios 7?

房东的猫 提交于 2019-12-11 14:37:53

问题


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?


回答1:


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.



来源:https://stackoverflow.com/questions/30615075/preferredcontentsize-not-working-in-ios-7

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!