I successfully created my "cell" object (based on UITableViewCell) and successfully used it when building the table through cellForRowAtIndexPath .
However, how can I deconstruct what I did in didSelectRowAtIndexPath ?
I am currently receiving the error message "Incompatible pointer types initializing" MyCell * __ strong "with an expression like" UITableViewCell "
Given that my object (MyCell) is based on a UITableViewCell, I donβt understand why I am getting this error.
Could you help me understand what I am doing wrong.
My alternative is to use "TAG" for each of the two labels in the cell and get them that way, but I'm just experimenting here, trying to learn more about how it all works.
Any help would be greatly appreciated.
- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath { static NSString *CellIdentifier = @"myCellID"; MyCell *cell = [tableView dequeueReusableCellWithIdentifier:CellIdentifier forIndexPath:indexPath]; if (cell == nil) { cell = [[MyCell alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier:CellIdentifier]; } cell.accountCode.text = @"0009810"; cell.accountName.text = @"Agent Name"; return cell; }
Here is another method. I get the error MyCell * cell = [tableView cellForRowAtIndexPath: indexPath];
- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath {
And here is MyCell
Any help would be appreciated.
source share