Wednesday, 15 April 2015

ios - Set the animator back to nil, in a UICollectionViewFlowLayout, when data reloaded? -



ios - Set the animator back to nil, in a UICollectionViewFlowLayout, when data reloaded? -

in other words -- how know, inside uicollectionviewflowlayout, when associated collection view has had info reloaded?

i'm using popular , awesome bpxlflowlayout brandon alexander,

https://github.com/whilethis/uikit-dynamics-101/blob/master/collection%20view%20dynamics/collection%20view%20dynamics/bpxlflowlayout.m

this best way create "bouncy" collections, such ios messages app.

how replicate messages bouncing bubbles in ios 7

i found real problem in bpxlflowlayout , other uicollectionviewflowlayout approaches. typically, "use them once" 1 layout, 1 collection view. have collection view "bouncyviewhouses"

@interface bouncyviewhouses : uicollectionviewcontroller

which uses bpxlflowlayout

everything's great until reload. or confusingly me, if utilize same bpxlflowlayout on collection view, seem have same problem.

to prepare problem, have

@implementation bouncyviewhouses -(void)safelyreloadbouncytable { [self.collectionview reloaddata]; [(bpxlflowlayout *)self.collectionview.collectionviewlayout fastsignal]; }

whenever reload collection, have "manually" 0 out animator.

so illustration within bpxlflowlayout added new method ...

@interface bpxlflowlayout () @property (nonatomic, strong) uidynamicanimator *animator; @end @implementation bpxlflowlayout -(void)fastsignal { // it's hard have preparelayout (or, anything) called when // reload collection data. in fact, must phone call manually. self.animator = nil; }

and have phone call manually collection views, when reload info source.

(if don't this, you'll hairy problems hard figure out!)

my problem .. you'd think within bpxlflowlayout (or similar) phone call self.animator = nil;

inside -(void)preparelayout or perhaps shouldinvalidatelayoutforboundschange:

but doesn't work! tried everything, in word can't figure out "what triggered" within uicollectionviewflowlayout, when info source reloaded on associated collection view.

i guess it's possible, nil triggered in uicollectionviewflowlayout .. in case, approach, of adding manual tickle "must call" when reload data, guess that's way.

ios uicollectionview uikit-dynamics

No comments:

Post a Comment