ios - Setting a view to hidden causes frame adjustments -
i'm working in collection view 1 of our cells able collapsed or expanded button press. original developer of feature gone, i'm trying understand going on. can tell, when user presses button, following code gets called:
- (void)expandcell{ [expandcollapsebutton settitle:@"-" forstate:uicontrolstatenormal]; [textview sethidden:no]; isexpanded = yes; [self.delegate celldidexpandcollapse]; }
our collapse cell virtually identical except don't hide it, set isexpanded
variable no
, set title "+" instead of "-". celldidexpandcollapse
delegate method calls updatecollection
method, i've copied below.
- (void)updatecollection { [self.collection performbatchupdates:nil completion:nil]; [self.amountcell updatetable]; [self.collection setneedslayout]; [self.collection layoutifneeded]; }
and that's it. yet, when layoutifneeded
called, system sets frame of textview have different origin , height of 0. i'm not sure why, understanding, hidden view still "present", has alpha of 0. since i'm not calling frame updating logic on textview when hit button, i'm not sure how frame being set.
are there properties of collectionview or view in general can set have frame collapse height when hidden? or there other magic properties should looking into?
edit: views not setup in stack view, shouldn't resizing, @ least far understand.
did use auto layout on cell? if so, hidden view still participates in layout. please refer how use auto-layout move other views when view hidden?
Comments
Post a Comment