Hello -
I'm writing some code for the iPhone, and have implimented a UITableView.
I have created a delegate and a dataSource. There is a strange issue however- When the table is displayed, the dataSource knows the correct *number* of cells to return, but returns duplicate copies of the 0th cell for all cells. Its behaving as if [UITableview reloadData] keeps asking cellForRowAtIndexPath for index 0.
Also, when clicking (tapping) on the cells, didSelectRowAtIndexPath only returns 0 for the tapped index.
Is this related to reuseIdentifier?
In my dataSource:
In my delegate:
Thank you in advance for any help !!
I'm writing some code for the iPhone, and have implimented a UITableView.
I have created a delegate and a dataSource. There is a strange issue however- When the table is displayed, the dataSource knows the correct *number* of cells to return, but returns duplicate copies of the 0th cell for all cells. Its behaving as if [UITableview reloadData] keeps asking cellForRowAtIndexPath for index 0.
Also, when clicking (tapping) on the cells, didSelectRowAtIndexPath only returns 0 for the tapped index.
Is this related to reuseIdentifier?
In my dataSource:
Code:
- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath
{
// Returns a formatted Table Cell
int index=[indexPath indexAtPosition:0] ;
printf("Creating cell for index %d\r\n",index); //Always prints 0!
In my delegate:
Code:
- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath
{
printf("Index of tapped item: %d\r\n", [indexPath indexAtPosition:0]); //Always prints 0
}
Thank you in advance for any help !!