Why is horizontal UIScrollView becoming less efficient at the bottom of the screen?

I want to create a code template for the horizontal scrollbar at the bottom of the frame. A UIScrollView based on this example works fine. When I drop it at the bottom of the frame, a scrollbar appears in the frame, as expected, but it scrolls.

I tried several times to gradually lower it gradually closer to the base of the frame, and as it approached it became harder and harder to scroll. I have never created scrollview, but I cannot understand why this will not work. What am I not doing?

Here is my code

 - (id)createHorizontalScrollMenu { CGRect frame = [UIScreen mainScreen].bounds; CGFloat drop = frame.size.height - 100; UIScrollView *scrollView = [[UIScrollView alloc] initWithFrame:CGRectMake(0, drop, frame.size.width, 100)]; int x = 0; for (int i = 0; i < 8; i++) { UIButton *button = [[UIButton alloc] initWithFrame:CGRectMake(x, 0, 100, 100)]; [button setTitle:[NSString stringWithFormat:@"Button %d", i] forState:UIControlStateNormal]; [scrollView addSubview:button]; x += button.frame.size.width; } scrollView.contentSize = CGSizeMake(x, scrollView.frame.size.height); scrollView.backgroundColor = [UIColor cyanColor]; return scrollView; } 
0
source share

Source: https://habr.com/ru/post/951080/


All Articles