Duy Doan
Duy Doan

Reputation: 51

Cannot click button on UIScrollview Objective - C

Can not detect click some UIButton on UIScrollview. I described my problem in image description.

CODE :

- (void)viewWillLayoutSubviews { 
    [super viewWillLayoutSubviews]; 
    CGFloat scrollViewHeight = 0.0f; 
    for (UIView* view in _vContain.subviews) { 
        scrollViewHeight += view.frame.size.height; 
    } 
    [_svContain setContentSize:(CGSizeMake(_svContain.frame.size.width, scrollViewHeight + 50))]; 
}

enter image description here

Upvotes: 0

Views: 604

Answers (1)

vegda neel
vegda neel

Reputation: 154

Please set ContentSize of your UIScrollView. Do it like this :

scroll.contentSize = CGSizeMake(ScreenWidth, btn.frame.origin.y+btn.frame.size.height +10);

set your UIScrollview height like i show you in your image.

enter image description here

Upvotes: 3

Related Questions