Reputation: 45
I have placed UIView
in UIScrollView
in Storyboard
. The UIView
is pinned to the all the sides of the UIScrollView
. I am trying to set the size of UIView
programatically because it is needed for scrolling to work properly. How can I programmatically set the width and height of the UIView
?
Thanks for any help as I am trying to solve the problem already for a week...
Upvotes: 0
Views: 3744
Reputation: 442
You'll need to change the frame of your view as below:
yourView.frame = CGRectMake(x,y,calculatedWidth,calculatedHeight);
Plus, you'll also need to check for the scroll view's frame so that it enlarges as per your view's width and height.
Upvotes: 1
Reputation: 8745
You need to set new frame to change width, height, x or y for example:
view.frame = CGRectMake(view.frame.origin.x, view.frame.origin.y, newWidth, newHeight);
Upvotes: 0