UIScrollview同时缩放和启用分页 [英] UIScrollview zoom and enable paging simultaneously

查看:114
本文介绍了UIScrollview同时缩放和启用分页的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我可以同时在uiscrollview中同时实现imageview的分页和缩放。

Can i implement both the paging and zooming of imageview in a uiscrollview at the same time.

推荐答案

是的。你能行的。
mainScrollView 的每个页面中添加包含 imageView subScrollView 。您需要执行以下操作。

Yes. You can do it. In each page of the mainScrollView add a subScrollView containing the imageView. You need to do the following things.


  1. subScrollView设置 maximumZoomScale

[subScrollView setMaximumZoomScale:2.0f];   // You can set any value

此值是根据显示在图像中的图像大小计算出来的。 imageView。

This value is calculated based on the size of the image displayed in the imageView.

subScrollView viewForZoomingInScrollView:方法中返回 imageView

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

    return imageView;
}   


  • mainScrollView中启用分页

    mainScrollView.pagingEnabled = YES;
    

    您必须编写更多代码来处理 mainScrollView 中的分页。 / p>


  • You have to write further code to handle paging in the mainScrollView.

    这篇关于UIScrollview同时缩放和启用分页的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

    查看全文
    登录 关闭
    扫码关注1秒登录
    发送“验证码”获取 | 15天全站免登陆