I have a couple of modal view controllers of certain size. I\'m trying to avoid the use of custom views (creating full screen black translucent overlay over current view, ad
The best way to do this is to change the bounds property on the superview of the view being presented inside the formsheet. When you present a view modally, the presented view is embedded inside another view.
You should set the bounds property of the superview to the same rect as the view's bounds. First add a private ivar in your class:
@implementation MySpecialFormsheet {
CGRect _realBounds;
}
It's best to do this in viewWillAppear:
. Add the following code to the view controller that is being presented modally:
- (void)viewWillAppear:(BOOL)animated {
[super viewWillAppear:animated];
self.view.superview.bounds = _realBounds;
}
You need to cache _realBounds
in your viewDidLoad
method:
- (void)viewDidLoad {
_realBounds = self.view.bounds;
[super viewDidLoad];
}