0

我的应用程序的 UIScrollView 滑动自动会反弹,我该怎么办?我不想!

我的代码如下:

- (void)initScrollView {
    // a page is the width of the scroll view 
        sv = [[UIScrollView alloc]initWithFrame:CGRectMake(0, 96, 320, 300)];
        sv.contentSize = CGSizeMake(sv.frame.size.width * 3, sv.frame.size.height* 2);
        sv.pagingEnabled = YES;
        sv.clipsToBounds = YES;
        sv.showsHorizontalScrollIndicator = NO;
        sv.showsVerticalScrollIndicator = YES;
        sv.scrollsToTop = NO;
        sv.directionalLockEnabled = YES;
        sv.delegate = self;
        [self.view addSubview:sv];

        currentPage = 0;
        pageControl.numberOfPages = 3;
        pageControl.currentPage = 0;
        pageControl.backgroundColor = [UIColor clearColor];
        [self createAllEmptyPagesForScrollView];
}
- (void)createAllEmptyPagesForScrollView {

    tapView1 = [[UIView alloc]init];
    tapView1.backgroundColor = [UIColor clearColor];
    tapView1.frame = CGRectMake(320*0, 0, 320, sv.frame.size.height);

    tapView2 = [[UIView alloc]init];
    tapView2.backgroundColor = [UIColor clearColor];
    tapView2.frame = CGRectMake(320*1, 0, 320, sv.frame.size.height);

    tapView3 = [[UIView alloc]init];
    tapView3.backgroundColor = [UIColor clearColor];
    tapView3.frame = CGRectMake(320*2, 0, 320, sv.frame.size.height);

    [sv addSubview:tapView1];
    [sv addSubview:tapView2];
    [sv addSubview:tapView3];
}
4

1 回答 1

0

我知道为什么我向上滑动会自动反弹,我的代码有问题!不是代码!谢谢大家!

于 2013-04-10T13:57:14.893 回答