Je travaille sur une application tvOS dans laquelle une cellule de vue de table personnalisée est utilisée, tandis que l'affichage de données à l'aide d'étiquettes fonctionne parfaitement mais la sélection de bouton ne fonctionne pas. Y at-il un moyen de faire la sélection de bouton à l'intérieur de la cellule de vue de table personnalisée fonctionne dans la vue de table tvOS?Impossible de sélectionner le bouton dans la cellule de vue de table personnalisée dans tvOS
extrait de code:
-(UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath
{
MsgDetailsTableViewCell *cell;
static NSString *simpleTableIdentifier = @"Cell";
cell = [tableView dequeueReusableCellWithIdentifier:simpleTableIdentifier];
if (cell == nil) {
cell = [[MsgDetailsTableViewCell alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier:simpleTableIdentifier];
}
NSDictionary*dataDict = [self.qArray objectAtIndex:indexPath.row];
NSString *followCountText = [NSString stringWithFormat:@"%@ Following",[[dataDict objectForKey:@"followCount"] stringValue]];
if([[dataDict objectForKey:@"followCount"] integerValue]!=0)
{
[cell.statusListBtn addTarget:self action:@selector(openLikedList:) forControlEvents:UIControlEventPrimaryActionTriggered];
cell.statusListBtn.tag=111;
cell.followCountLbl.textColor = [UIColor colorWithRed:0/255.0 green:95/255.0 blue:167/255.0 alpha:1.0];
}
else
{
[cell.statusListBtn removeTarget:self action:@selector(openLikedList:) forControlEvents:UIControlEventPrimaryActionTriggered];
cell.statusListBtn.tag=111;
cell.followCountLbl.textColor = [UIColor grayColor];
}
cell.followCountLbl.text=followCountText;
return cell;
}
Dans le code ci-dessus Sélection de statusListBtn ne fonctionne pas.
s'il vous plaît partager le code de méthode 'cellForRowAt' – Indrajeet
question éditée @Indrajeet –