Can't limit panning area of Scrollview inside CollectionViewCell -


i have images , open them in collectionview, album, user can swipe left , right , can pinch zoom. use scrollview inside cell , image inside scrollview

my problem when pinch zoom image zooms, after when navigate on image, goes , down much, want limit navigation on picture frame, couldnt manage it, tried everything, searched lot, couldnt able it, wanted ask you.

you can see image below , understand mean better.

http://s8.postimg.org/oypni96id/image.png

here code

import uikit  class slideviewcontroller: uiviewcontroller, uicollectionviewdatasource, uicollectionviewdelegate, uiscrollviewdelegate {     @iboutlet weak var collectionview: uicollectionview!     var images = ["image1.jpg" , "image2.jpg" , "image3.jpg" , "image1.jpg" , "image2.jpg" , "image3.jpg" , "image1.jpg" , "image2.jpg" , "image3.jpg" , "image1.jpg"]     var flowlayout:uicollectionviewflowlayout = uicollectionviewflowlayout()      override func viewdidload() {         super.viewdidload()                 // additional setup after loading view, typically nib.     }      override func didreceivememorywarning() {         super.didreceivememorywarning()         // dispose of resources can recreated.     }      func collectionview(collectionview: uicollectionview, cellforitematindexpath indexpath: nsindexpath) -> uicollectionviewcell {         let cell:uicollectionviewcell = collectionview.dequeuereusablecellwithreuseidentifier("cell", forindexpath: indexpath) as! uicollectionviewcell          var scrollview:uiscrollview = cell.viewwithtag(1) as! uiscrollview         var image:uiimageview = scrollview.viewwithtag(2) as! uiimageview         self.flowlayout.minimumlinespacing = 0.0         self.flowlayout.scrolldirection = uicollectionviewscrolldirection.horizontal         self.collectionview.setcollectionviewlayout(self.flowlayout, animated: true)         image.image = uiimage(named: images[indexpath.row])          return cell     }      func collectionview(collectionview: uicollectionview, numberofitemsinsection section: int) -> int {         return 10     }      func numberofsectionsincollectionview(collectionview: uicollectionview) -> int {         return 1     }      func collectionview(collectionview: uicollectionview, layout collectionviewlayout: uicollectionviewlayout, sizeforitematindexpath indexpath: nsindexpath) -> cgsize {         let frame = view.frame          return cgsizemake(frame.width, frame.height)     }      func viewforzoominginscrollview(scrollview: uiscrollview) -> uiview? {         var image:uiimageview = scrollview.viewwithtag(2) as! uiimageview          return image     }      func collectionview(collectionview: uicollectionview, willdisplaycell cell: uicollectionviewcell, foritematindexpath indexpath: nsindexpath) {         var scrollview:uiscrollview = cell.contentview.viewwithtag(1) as! uiscrollview         scrollview.zoomscale = 1.0     }    } 

issue can closed, used mwphotobrowser gallery instead of solving problem. thank anyway ;)


Comments