Reputation: 2076
i want to add custom EditingAccessoryView in cell, when user swipe in place of delete button i want to show my custom view.
Upvotes: 4
Views: 7801
Reputation: 2076
Design view from xib like bellow example
now make IBOutlet of uiview in .h file
IBOutlet UIView *accessoryView;
connect that IBOutlet to your design view.
now in .m file set that view as editingAccessoryView of table cell
- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath {
static NSString *CellIdentifier = @"Cell";
UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:CellIdentifier];
if (cell == nil) {
cell = [[[UITableViewCell alloc] initWithStyle:UITableViewCellStyleSubtitle reuseIdentifier:CellIdentifier] autorelease];
cell.editingAccessoryView = accessoryView;
}
}
- (BOOL)tableView:(UITableView *)tableView canEditRowAtIndexPath:(NSIndexPath *)indexPath {
return NO;
}
now when you swipe your custom view will show in place of delete button
Upvotes: 0
Reputation: 423
There doesn't seem to be a function for that. All you can do is give a custom text for the Delete confirmation button, by using the function below.
- (NSString *)tableView:(UITableView *)tableView titleForDeleteConfirmationButtonForRowAtIndexPath:(NSIndexPath *)indexPath
Upvotes: 2