开发者

Delete Button in UITableView

开发者 https://www.devze.com 2023-04-01 07:41 出处:网络
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:

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:

  1. Make your UITableView style Grouped.
  2. Add +1 section to your table.
  3. Say to your table that it is one cell for last section
  4. 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];

0

精彩评论

暂无评论...
验证码 换一张
取 消