I have a tableview with each cell loaded from a xib. It is in the format UILabel some space and UITextField. On a button click somewhere on the view I need the action to fetch all the textfield values in the UITableView with the labels in a dictionary. The problem is when I alloc a cell and fetch the values from there using indexPath, the code crashes exactly at the indexPath of the cell which is invisible (out of screen bounds).
I would appreciate any good ideas on how to fetch those cells which are not visible on screen.
Thanks!
UITableViewCells are reused when they scroll out of view, so that's probably why it won't let you access attributes of UITableViewCells that are not visible.
An NSDictionary might be your best bet:
UITextField based on the indexPath.row value during cell creation.UITextField to your view controller.textFieldDidEndEditing, update your dictionary as such: [dictionary setObject:textField.text forKey:[NSNumber numberWithInt:textField.tag]]And now you can access an array of your textField values with [dictionary allValues].
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