mardi 5 juillet 2016

Controls in a UIScrollView won't work below screen height


I have UIButtons/UISliders around 900 pixels down a UIView which is on a UIScrollView. I am alloc/init the scrollView and the UIView frame at 0,0,375,950 and setting the scrollView.contentSize to the same and have enabled userInteraction. Yet I am unable to interact with any controls below the size of the screen(outside of 675 y).

self.viewInsideScrollView = [[UIView alloc]initWithFrame:CGRectMake(0, 0, 375, 950)];
self.viewInsideScrollView.userInteractionEnabled = YES;

self.scrollView.contentSize = CGSizeMake(self.viewInsideScrollView.frame.size.width, self.viewInsideScrollView.frame.size.height);
self.scrollView = [[UIScrollView alloc]initWithFrame:CGRectMake(0, 0, 375, 950)];
self.scrollView.delegate = self;
self.scrollView.scrollEnabled = YES;
self.scrollView.userInteractionEnabled = YES;
self.scrollView.scrollsToTop = YES;
self.scrollView.clipsToBounds = YES;
[self.scrollView addSubview:self.viewInsideScrollView];

The buttons, sliders and a colletionView were all added and constrained to the UIView on top of the scrollView via Storyboards


Aucun commentaire:

Enregistrer un commentaire