Je suis capable de créer un tableview
avec textlabel
et avec detaillabeltext
.Comment placer UIButton dans la cellule uitableview?
En plus de cela, est-il possible d'ajouter UIButton
dans la cellule.
Je veux dire après la detaillabeltext, puis-je placer un UIButton
(comme "Supprimer")
i ont actuellement le code suivant
// Customize the appearance of table view cells.
- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath
//-----------------------------------------------------------------------------------------------------
{
static NSString *CellIdentifier = @"Cell";
UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:CellIdentifier];
profileName = [appDelegate.sentItemsList objectAtIndex:indexPath.row];
if (cell == nil)
{
cell = [[[UITableViewCell alloc] initWithStyle:UITableViewCellStyleSubtitle reuseIdentifier:CellIdentifier] autorelease];
cell.selectionStyle = UITableViewCellSelectionStyleNone;
}
NSString *subjectData = [profileName.sent_subject stringByTrimmingCharactersInSet: [NSCharacterSet whitespaceAndNewlineCharacterSet]];
cell.textLabel.text = [NSString stringWithFormat: @"%@ ", subjectData];
cell.textLabel.font = [UIFont boldSystemFontOfSize:13];
NSString *CompanyName = [profileName.sent_content stringByTrimmingCharactersInSet: [NSCharacterSet whitespaceAndNewlineCharacterSet]];
cell.detailTextLabel.text = [NSString stringWithFormat: @"%@ ",CompanyName];
cell.detailTextLabel.font = [UIFont systemFontOfSize:10];
cell.accessoryType = UITableViewCellAccessoryDetailDisclosureButton;
cell.backgroundColor = [UIColor colorWithRed:230.0/255.0 green:249.0/255.0 blue:230.0/255.0 alpha:2.0];
return cell;
}
Merci pour votre temps et aide!
double possible de [UIButton dans la cellule UITableView comme "Supprimer l'événement"] (http://stackoverflow.com/questions/1076785/uibutton-in-uitableview- cell-like-delete-event) –
Pour quoi faire, vous voulez ajouter le bouton? Comme si vous vouliez implémenter une fonctionnalité de suppression, vous pouvez utiliser un accessoire, sinon vous devrez implémenter chaque chose comme une sous-vue de votre cellule de vue de table. – rptwsthi
@rptwsthi: pas comme la fonctionnalité de suppression. je veux appeler mon "ajouter aux favoris" bouton – user198725878