I've drawn a UIView
(scrollInner) in Interface Builder and I now want to increase its height programmatically and also change its background colour.
The UIView
is inside a UIScrollView
, and the scrolling all works fine. Basically, what I'm doing is trying to increase the inner UIView
so it matches the contentSize of the UIScrollView
.
Here's what I've got so far in my viewDidAppear
method:
CGRect scrollInnerRect = self.scrollInner.frame;
scrollInnerRect.size.height = 1000;
self.scrollInner.frame = scrollInnerRect;
[self.scrollInner setBackgroundColor:[UIColor redColor]];
The background colour of the UIView
changes to red as expected, but the height of the 'UIView' remains the same size as it was set in Interface Builder.
However, if I do this:
NSLog(@"My uiview's frame is: %@", NSStringFromCGRect(scrollInner.frame));
I get this in the log:
My uiview's frame is: {{0, 150}, {320, 1000}}
...which suggests that the UIView
's height has been increased.
But that's not how it appears in the simulator. In other words, on screen the UIView
is coloured red, but DOES NOT have the new height of 1000px - it's still way shorter.
Any ideas where I might be going wrong?
Thx.