I have made a custom UIView which is shown when the user hits a button in the navigationbar. I make my view’s in code. In my loadview I set the autoresizing masks and the view loads correct on screen. However the UIView which is shown when the user taps the button does not resize even when I have set the autoresizing masks.
UIView *blackView = [[UIView alloc] initWithFrame:CGRectMake(0.0, 0.0, 320.0, 416.0)];
blackView.autoresizingMask = UIViewAutoresizingFlexibleWidth | UIViewAutoresizingFlexibleHeight;
Do I need to use self.view.frame.size.width and self.view.frame.size.height instead? And if I do why? Does not resizing masks work outside of loadView?
Thank you for your time:)
the
autoresizingMaskaffects how a view will behave when its superviews frame changes. if all you are doing is showing theblackViewwhen you tap a button, thenblackView` will have whatever frame you initially set for it.If this isn’t enough info, please post some more code around how you are configuring and displaying
blackViewand it’s superview and explain more about what situations you are expectingblackViewto resize in. Rotation is one of them, if that’s what you’re concerned with.