滚动视图

修改ThirdViewController.xib,添加scroll View和image View

将imageView关联到成员变量_imageView

将scrollView关联到成员变量_scrollView

imageView中放入一张大图片。

去掉 Use Autolayout属性。

修改viewDidLoad

- (void)viewDidLoad

{

    [superviewDidLoad];

    // Do any additional setup after loading the view from its nib.

    _scrollView.contentSize=_imageView.image.size;

    _imageView.frame=CGRectMake(0,0, _imageView.image.size.width,_imageView.image.size.height);

    

}

修改scrollView的zoom 0.25到4

设置UIScrollViewDelegate

- (UIView *)viewForZoomingInScrollView:(UIScrollView *)scrollView

{

    return_imageView;

}

源码地址:http://download.csdn.net/detail/cloud95/5187576

你可能感兴趣的:(滚动视图)