Add blank cell at end of UITable
Posted
by Michael
on Stack Overflow
See other posts from Stack Overflow
or by Michael
Published on 2010-04-29T13:13:33Z
Indexed on
2010/04/29
13:17 UTC
Read the original article
Hit count: 306
uitableview
|iphone
I'm trying to add an additional cell for custom content as the last cell in a tableView, without altering the dictionary that creates the other content of the table. I think the place to add it is in cellForRowAtIndexPath
rather than adding one to the numberOfRowsInSection
, which just crashes if I do.
I get a cellCount
from the dictionary that creates the data for the table, then in cellForRowAtIndexPath
, I have:
if (indexPath.row == cellCount) {
... stuff goes here
return cell;
}
of course, this never gets called. If I do if (indexPath.row == cellCount -1)
it overwrites the last cell with content.
I can get this to work if I add a blank entry into the xml from which I am populating the dictionary, but that's ugly.
Example code would be neat!
© Stack Overflow or respective owner