0
votes

When I scroll, I cant roll to the end of UIView.

My UIScrollView have 450 of height and the UIView inside scrollView 800 of height. The problem is what the scrollView cannot reach the end of the UIView... the scroll only down to a point and does not show more content of UIView. (I use storyboard)

Here is my code for start the scrollView and UIView:

[super viewDidLoad];

[scrollView setBackgroundColor:[UIColor blackColor]];

[scrollView setCanCancelContentTouches:NO];

scrollView.clipsToBounds = YES;

scrollView.indicatorStyle = UIScrollViewIndicatorStyleWhite;


[scrollView addSubview:content];


//NSLog(@" %f  %f",content.frame.size.width,content.frame.size.height);


[scrollView setContentSize:CGSizeMake(content.frame.size.width, content.frame.size.height  )];

//NSLog(@" %f  %f",scrollView.frame.size.width,scrollView.frame.size.height );

[scrollView setScrollEnabled:YES];

Any help on this issue is appreciated. (Sorry for my bad eng :( )

Thanks.

1
please explain the question well and paste more code.. - Shamsudheen TK
What is the origin of your content view? (content.frame.origin.x / y). Maybe they are not 0,0 in that case you have to account for that in your [scrollView setContentSize] - Mindaugas
content.frame.originx/y is 0 - 0 . Is normal content.frame.size.w/h = 0 and scrollView.frame.size.w/h = 0 ? - Carnageek

1 Answers

0
votes

If you're doing this in an iOS 6 project with constraints enabled for the storyboard, and if (as it appears) the code you posted is from the viewDidLoad method, then your outlet object frames are going to be zero size. With constraints, the frame sizes have not yet been determined and set at the point in execution where viewDidLoad runs.

If you create a button on your page, and put the code into that button's click handler, do things start working? If so, it's because you can't click the button until full load process is finished -- meaning that the code works once full load process is done but not mid-process where you're running it (in viewDidLoad event).