我使用了scrollview,并且在scrollview中我现在添加了文本图像,当我滚动时,滚动效果不平稳,或者向上或向下。
我使用的代码是:
mScrollView.delegate = self;
//mScrollView.showsHorizontalScrollIndicator = FALSE;
[mScrollView setFrame:CGRectMake(0, 10, 1024, 768)];
// a page is the width of the scroll view
mScrollView.pagingEnabled = YES;
mScrollView.scrollsToTop = NO;
[mScrollView addSubview:mImgView];
// setting image according to the tag
if ( mTag == 0 )
{
[mBckImgView setImage:[self getImageFromName:@"ombgiphone"]];
[mImgView setFrame:CGRectMake(0, 10, 320, 1063)];
mImgView.image = [self getImageFromName:@"introtextiphone"];
[mScrollView setContentSize:CGSizeMake(320, 1400)];// size of the image
}
最佳答案
pagingEnabled
服务于另一个目的。我猜你不想在这里分页。因此,pagingEnabled
应该为NO
以使其平滑滚动。
mScrollView.pagingEnabled = NO;
关于iphone - UIScrollview不能平滑滚动,我们在Stack Overflow上找到一个类似的问题:https://stackoverflow.com/questions/6506857/