hazelvan
hazelvan

Reputation: 133

UIScrollView bounces back

I have a UIScrollView embedded in a UIView. When scrolled down it bounces back to its viewable screen. I haven't got any clear fix on this.. I've looked at all the other questions.. no answer has been possible to my app. This is my code...

-(void)viewDidAppear
{
    const CGFloat BoardWidth = 320;
    const CGFloat BoardHeight = 480;
    self.cScrollLabel.frame = CGRectMake(0, 0, BoardWidth, BoardHeight);
    self.cScrollLabel.contentSize = CGSizeMake(BoardWidth, 2 * BoardHeight);
    [super viewDidLoad];
}

I've disabled paging, enabled scrolling... What do I do?!?!?

Upvotes: 0

Views: 899

Answers (1)

iPhone Programmatically
iPhone Programmatically

Reputation: 1227

Try this, if it works.

to disable bounce use this -> scrollView.bounces = NO; to disable horizontal scrolling set content size of scrollview like this ->

float sizeOfContent = 0;
UIView *lLast = [scrollView.subviews lastObject];
NSInteger wd = lLast.frame.origin.y;
NSInteger ht = lLast.frame.size.height;

sizeOfContent = wd+ht;

scrollView.contentSize = CGSizeMake(scrollView.frame.size.width, sizeOfContent);

Upvotes: 1

Related Questions