问题
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