I would like a UITextView
to fill its superView
, which is a plain UIView
inside a UIViewController
instance.
It s
And here Swift 3 solution:
myView.autoresizingMask = [.flexibleWidth, .flexibleHeight]
Autoresizing does not mean that the subview will take up the size of its superview. It just means that it will resize relative to the size change of its superview whenever the superview's bounds change. So initially, you have to set the size of the subview to the correct value. The autoresizing mask will then deal with size changes in the future.
This is all you need:
textView = [[[UITextView alloc] autorelease] initWithFrame:self.view.bounds];
[textView setAutoresizingMask:UIViewAutoresizingFlexibleWidth|
UIViewAutoresizingFlexibleHeight];