i want a Delete Button in my UITableView like in die AdressBook when editing a contact.
Is this a custom开发者_开发问答 cell, or a UIButton?
To make such button you can do following:
- Make your
UITableView
styleGrouped
. - Add +1 section to your table.
- Say to your table that it is one cell for last section
- Just return custom cell (with red background and appropriate label) for last section
If you implement the Delegate method's for edit the tableview
- (void)tableView:(UITableView *)tableView willBeginEditingRowAtIndexPath:(NSIndexPath *)indexPath
And than implement the DataSource method
- (void)tableView:(UITableView *)tableView commitEditingStyle:(UITableViewCellEditingStyle)editingStyle forRowAtIndexPath:(NSIndexPath *)indexPath
For allowing to get that delete button when you swipe a cell use the
Cell Editing Style : UITableViewCellEditingStyleDelete
// Edit: Wrong answer. Do you mean the Big one at the bottom or with the sign on the left?
use.... firstly use
[btn removeFromSuperview];
and
[tblobj reload];
精彩评论