Swift中的图库

时间:2015-03-02 11:51:03

标签: uiscrollview

我在scrollview中有20个imageview,我在SubScrollView中的下一个ViewController中显示所选图像......

我想缩放特定的imageView,我不知道得到那个imageview标签,这是我的代码

func viewForZoomingInScrollView(scrollView: UIScrollView) -> UIView?
{
    var i : Int = 0
    var imgView = UIImageView()
   for img in scrollView.subviews
   {
        imgView = view.viewWithTag(Tags.Tag_imgView.rawValue + i)
        imgView = img as UIImageView
        break
   }
    return imgView
}

1 个答案:

答案 0 :(得分:0)

func viewForZoomingInScrollView(scrollView: UIScrollView) -> UIView?
{
   var imgView : UIImageView? = view.viewWithTag(Tags.Tag_imgView.rawValue) as? UIImageView
   for img in scrollView.subviews
   {
        imgView = img as? UIImageView
        break
   }
    return imgView
}