I have a UICollectionView. Each cell contains a UITextField. I want a callback when display is complete, so I can query a model object for which textField should be the firstResponder, then make it the firstResponder. Can I get that callback? Or is there another natural way to accomplish this?
If you send the layoutIfNeeded
message to your collection view, it will update its children (adding and deleting cells as necessary) before returning. Thus you can make it update synchronously, then perform your post-reload actions.
[myCollectionView layoutIfNeeded];
[self chooseFirstResponderFromCells:myCollectionView.visibleCells];
As far as an actual callback method, I don't think there is one for collection view loading. The only one I know is performBatchUpdates:completion
, and that's pretty unrelated. In my experience, though, collection views are loaded and ready to go by the time viewDidAppear
is called, so I would set the first responder there.
Hope this helps!
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With