I've used UIScrollview
in my iPhone app
. I've set default size of UIScrollview
320 * 548
. I want to increase UIScrollview
height dynamically using programming but i am not succeed yet. I've used below code
CGRect scrollFrame;
scrollFrame.origin = _tblScroolView.frame.origin;
scrollFrame.size = CGSizeMake(320, 700);
_tblScroolView.frame = scrollFrame;
Please help me
Thanks!
To change the size of scroll view
scrollView.frame = CGRectMake(originX, originY, width, height);
to change the size of scrollable area:
scrollView.contentSize = CGSizeMake(width, height);
Swift 3 version
scrollView.frame = CGRect(x: scrollX, y: scrollY, width:width, height:height)
scrollView.contentSize = CGSize(width:width, height: height)
trigger any function when you need to increase your scrollview then use this code in that function and make your desired size for scrollview
scrollViewName.frame = CGRectMake(originX, originY, width, height);
change scrollable area
scrollViewName.content.size = CGSizeMake(width, height);...
int height = 600;
for (i = 0; i<5; i++)
{
// do what you want. suppose you create a view which size is - 10,10,300,800.
height = createdView.frame.size.height+10;
}
scrollView.contentSize = (320, height);
Hope this will help you.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With