How to disable horizontal scrolling of UIScrollView?

前端 未结 14 1889
伪装坚强ぢ
伪装坚强ぢ 2020-12-02 08:17

I have a UIView like iPhone\'s Springboard. I have created it using a UIScrollView and UIButtons. I want to disable horizontal scrolli

14条回答
  •  不思量自难忘°
    2020-12-02 09:01

    since iOS7 use

    self.automaticallyAdjustsScrollViewInsets = NO;
    

    //and create you page scroller with 3 pages

        self.pageView = [[UIScrollView alloc] initWithFrame:CGRectMake(0, 0, self.view.frame.size.width, self.view.frame.size.height)];
        [self.pageView setContentSize:CGSizeMake(self.view.frame.size.width*3, self.view.frame.size.height)];
        [self.pageView setShowsVerticalScrollIndicator:NO];
        [self.pageView setPagingEnabled:YES];
        [self.view addSubview:self.pageView];
    

提交回复
热议问题