我有一个UIScrollView
加载三个不同页面的页面。
当我放大页面并缩小到原始大小时,应用程序停止让我在页面之间滚动,就好像禁用了分页一样。当缩小到原始大小(Scale == 1)时,我该怎么做才能重新启用分页?
这是我的代码
- (void)viewDidLoad
{
[ScView setMaximumZoomScale : 2.0f];
[ScView setMinimumZoomScale : 1.0f];
ScView.contentSize = CGSizeMake(1024*3, 1.0);
ScView.pagingEnabled = YES;
ScView.clipsToBounds = YES;
ScView.delegate = self;
ScView.showsHorizontalScrollIndicator = NO;
ScView.showsVerticalScrollIndicator = NO;
[super viewDidLoad];
[self returnImages];
}
-(void)returnImages{
for (pageNumber = 1; pageNumber <= 3; pageNumber++) {
imagen = [[UIImageView alloc] initWithImage:[UIImage imageNamed:[NSString stringWithFormat:@"%d.png",pageNumber]]];
imagen.frame = CGRectMake((pageNumber-1)*1024, 0, 1024, 768);
[ScView addSubview:imagen];
}
}
//
- (UIView *)viewForZoomingInScrollView:(UIScrollView *)scrollView{
return ScView;
// return [imagen initWithImage:[UIImage imageNamed:[NSString stringWithFormat:@"%d.png",pageNumber]]];
}
- (void)scrollViewWillBeginZooming:(UIScrollView *)myScrollView withView:(UIView *)view
{
NSLog(@"Scroll Will Begin");
ScView.scrollEnabled = YES;
}
- (void)scrollViewDidEndZooming:(UIScrollView *)myScrollView withView:(UIView *)view atScale:(float)scale
{
if(scale == 1)
{
ScView.scrollEnabled = YES;
ScView.pagingEnabled = YES;
[self returnImages];
NSLog(@"Scrolol will end");
//ScView.maximumZoomScale = 2.0f;
// [super viewDidLoad];
[self returnImages];
}
}
任何想法将不胜感激..