i want to add 开发者_开发问答custom EditingAccessoryView in cell, when user swipe in place of delete button i want to show my custom view.
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
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
精彩评论