My for statement seems to be returning more than it should be, and causing an error. Here is the code…
for (BookCustomCell *bcc in [self.tableView subviews])
{
if (bcc.rowIDTag == [bookID intValue])
{
//Do something here.
}
}
As I step through this everything seems to be fine. It goes through the For statement four times, and each time bcc.rowIDTag exists and has a value. It then goes through it a fifth time. bcc.rowIDTag does not exist and as a result it crashes (SIGABRT).
- Why would it be going through a fifth time?
- Conceptually, what am I missing? (The way I understand things it finds all the
BookCustomCells in the tableView subviews and then iterates through each of them. Is that correct?) - Is there a better way to accomplish my goal? (I have a tableview with multiple rows. Each
row has multiple buttons which are in a custom cell. When I click a button I need to act upon all of the other buttons within that one row/cell.)
(None of this programming stuff is coming easy for me, but I’m bound and determined to learn it. Thanks for your help.)
Your code is wrong,
UITableViewcontains some subviews that are notUITableViewCell‘s, that’s why you’re getting SIGABRT crashes.This should do the trick.