ios - Autolayout Contraints Changes in CollectionViewCell -
i using purelayout create constraints
in cellforitematindexpath
if (!_itemdetails){ _itemdetails = cell.itemdetails; _itemdetailsconstraint = [_itemdetails autopinedge:aledgebottom toedge:aledgebottom ofview:cell.imageview]; } and in scrolldidview
float scrollviewheight = self.collectionview.frame.size.height; float scrolloffset = self.collectionview.contentoffset.y; if(_itemdetails){ if (scrolloffset + scrollviewheight < cgrectgetmaxy(_frontimageview.frame)){ _itemdetailsconstraint.constant = cgrectgetmaxy(_frontimageview.frame) - (scrolloffset + scrollviewheight); } else{ _itemdetailsconstraint.constant = 0; } } [_itemdetails.superview layoutifneeded]; eventhough while debugging, can see constraint's constant changed, view doesn't update new location.
i tried
[self.view layoutifneeded] and
[self.collectionview layoutifneeded] how can update view's (_itemdetails, point view in collectionviewcell) location?
[collectionview reloaddata]; if contraints create or update in collection:cellforitematindexpath:,you can reload cell.
Comments
Post a Comment