Ahm*_*med 3 iphone objective-c uiscrollview uiimageview image-zoom
我有一个UIScrollview与UIImageView在那里我从一个图像到另一个滚动内.
我使用TapToZoom Apple示例代码来实现缩放,但每当我缩放时,滚动视图都从开始而不是活动图像开始.
这是我的一段代码:
初始化并填充imageview:
table = [[NSMutableArray alloc] initWithCapacity:7];
for(int count = 1; count <= 7; count++)
{
NSString *fileName = [NSString stringWithFormat:@"image%d.jpg", count];
UIImage *image = [UIImage imageNamed:fileName];
[table addObject:image];
if (image == nil) {
break;
}
imageView = [[UIImageView alloc] initWithImage:image];
imageView.userInteractionEnabled = YES;
imageView.multipleTouchEnabled = YES;
Run Code Online (Sandbox Code Playgroud)
实施Tap手势:
UITapGestureRecognizer *singleTap = [[UITapGestureRecognizer alloc] initWithTarget:self action:@selector(handleSingleTap:)];
UITapGestureRecognizer *doubleTap = [[UITapGestureRecognizer alloc] initWithTarget:self action:@selector(handleDoubleTap:)];
Run Code Online (Sandbox Code Playgroud)
该handleDoubleTap方法缩放到中心,imageView并将scrollview带到分页的开始.
我对此进行了大量搜索,但无法找到放大实际显示图像的方法.
提前致谢 :)
查看Apple的PhotoScroller示例:
http://developer.apple.com/library/ios/#samplecode/PhotoScroller/Introduction/Intro.html
| 归档时间: |
|
| 查看次数: |
6048 次 |
| 最近记录: |