ios - Resize UICollectionView after view transition -


i've built detail view in interface builder showing informations , photos object. because lenght of informations , number of photos vary, nested in uiscrollview.

photos shown in uicollectionview, need show contained photos, disabled scrolling , dynamically changing height constraint of uicollectionview function (called when finishing rendering cells):

func resizephotoscollectionview() {     photoscollectionviewheightconstraint.constant = photoscollectionview.collectionviewlayout.collectionviewcontentsize() } 

it works great until uicollectionview needs resize (typically device orientation change). trying use uiviewcontrollertransitioncoordinator in function:

override func viewwilltransitiontosize(size: cgsize, withtransitioncoordinator coordinator: uiviewcontrollertransitioncoordinator) {     coordinator.animatealongsidetransition(nil) { context in         self.resizephotoscollectionview()     }     super.viewwilltransitiontosize(size, withtransitioncoordinator: coordinator) } 

but result jerky because height constraint changed after transition complete.

is there way how automatically resize uicollectionview after view transition? if not, how animate height constraint change during transition?

using xcode 6.1 target ios 8.

have tried wrapping constraint update view animation?

photoscollectionviewheightconstraint.constant =     photoscollectionview.collectionviewlayout.collectionviewcontentsize() photoscollectionview.setneedsupdateconstraints()  uiview.animatewithduration(0.3, animations: { () -> void in     photoscollectionview.layoutifneeded() }) 

Comments

Popular posts from this blog

c++ - QTextObjectInterface with Qml TextEdit (QQuickTextEdit) -

javascript - angular ng-required radio button not toggling required off in firefox 33, OK in chrome -

xcode - Swift Playground - Files are not readable -