Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

UIScrollView contentSize Issue

Within my view I create a scrollview with a width of 320 and a height of 70.

Responding to the user touching a button, I expand the scrollview, so it is 380(h) x 320(w) in size.

The code for this is shown below:

CGRect scrollviewFrame = CGRectMake(0, 30, 320, 380);
[scrollView setFrame:scrollviewFrame];
[self layoutScrollImages:YES];
CGSize srect =  CGSizeMake([scrollView bounds].size.width, (kNumImages * kScrollObjHeight));
[scrollView setContentSize:srect];

As I debug this project, I can see that srect is 320 (w) x 8000 (h) in size; however my issue is the scrollable area (where the user can actually touch to scroll the scrollview) remains the same as when it was it's original size.

I'm obviously missing something, does anyone know what it is?

Edit: I have created a sample project to illustrate the issue I am having, it is available here: http://dl.dropbox.com/u/9930498/ScrollViewTest.zip

like image 264
Mick Walker Avatar asked Nov 13 '22 22:11

Mick Walker


1 Answers

I think , you have issue with your below line of code.

CGSize srect =  CGSizeMake([scrollView bounds].size.width, (kNumImages * kScrollObjHeight));
   [scrollView setContentSize:srect];

debug your program and see the content of srect , Also let us know the value of below two constant

kNumImages,kScrollObjHeight .

like image 187
Jhaliya - Praveen Sharma Avatar answered Dec 21 '22 06:12

Jhaliya - Praveen Sharma