ios - UICollectionViewFlowLayout not invalidating right on orientation change -


i have uicollectionview uicollectionviewflowlayout. implement uicollectionviewdelegateflowlayout protocol.

in datasource have bunch of uiviewcontrollers respond custom protocol can ask size , other stuff.

in in flowlayout delegate when asks sizeforitematindexpath:, return item size protocol. viewcontrollers implement protocol return different item size depending on orientation.

now if change device orientation portrait landscape theres no problem (items larger in landscape) if change back, warning:

    item width must less width of uicollectionview minus section insets left , right values.     please check values return delegate. 

it still works don't warnings maybe can tell me doing wrong. there problem. if don't tell collectionviews collectionviewlayout invalidate in willanimaterotationtointerfaceorientation: sizeforitematindexpath: never called.

hope understand mean. if need additional information let me know :)

one solution use kvo , listen change frame of superview collection view. calling -reloaddata work , rid of warnings. there underlying timing issue here...

// -loadview [self.view addobserver:self forkeypath:@"frame" options:nskeyvalueobservingoptionnew context:nil];  // -dealloc [self.view removeobserver:self forkeypath:@"frame"];  // kvo method - (void)observevalueforkeypath:(nsstring *)keypath ofobject:(id)object change:(nsdictionary *)change context:(void *)context {     [collectionview_ reloaddata]; } 

Comments

Popular posts from this blog

linux - Does gcc have any options to add version info in ELF binary file? -

android - send complex objects as post php java -

charts - What graph/dashboard product is facebook using in Dashboard: PUE & WUE -