I have a very strange issue with the tableview:
I have a table cell where I created a segue to another tableview
I initiate the table cell using the below code with style “UITableViewCellStyleSubtitle”:
The problem I have is that touch of the table cell is not triggering the segue(prepareForSegue is not called), but if I change the table cell style to default, then it works.
Does anyone know, what is wrong? Thanks a lot!
- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath
{
static NSString * const kPlacesCellIdentifier = @”Cell99″;
UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:kPlacesCellIdentifier];
cell = [[UITableViewCell alloc] initWithStyle:UITableViewCellStyleSubtitle reuseIdentifier:kPlacesCellIdentifier];
//cell.editingAccessoryType = UITableViewCellAccessoryDetailDisclosureButton;
CountryCustomers *aCountryCustomer = [_countryCustomersList objectAtIndex:indexPath.row];
cell.textLabel.text = aCountryCustomer.countryName;
NSString *detailTextLable = [@"Users:" stringByAppendingString:[NSString stringWithFormat:@"%d", aCountryCustomer.userNumbers]];
cell.detailTextLabel.text = detailTextLable;
cell.accessoryType = UITableViewCellAccessoryDisclosureIndicator;
//add the national flag
NSString *imageName = [NSString stringWithFormat:@"%@.png",aCountryCustomer.countryName];
cell.imageView.image = [UIImage imageNamed:imageName];
return cell;
}
It happens because you are create another cell, you shouldnt call
after
since
dequeueReusableCellWithIdentifieralready creates the cellTo change the cell type go to the story board and change, select the cell, and change style to Subtitle