开发者

Editing Style of UITableView - Add/Delete

开发者 https://www.devze.com 2023-03-08 09:15 出处:网络
I added the following code in my UITableViewController subclass, it shows something like in the screen shot, which is like a radio button, can select/deselect it. Selected button does have red-colored

I added the following code in my UITableViewController subclass, it shows something like in the screen shot, which is like a radio button, can select/deselect it. Selected button does have red-colored tick symbol. What is the button meant for?

- (UITableViewCellEditingStyle)tableView:(UITableView *)tableView editingStyleForRowAtIndexPath:(NSIndexPath *)indexPath { 
return UITableViewCellEditingStyleDelete | UITabl开发者_JAVA百科eViewCellEditingStyleInsert; 
}  

Editing Style of UITableView - Add/Delete


The function you have used is for selecting value/values from the list in the table view. But before you use this function you have to include two more functions in your viewController :

- (UITableViewCellEditingStyle)tableView:(UITableView *)tableView editingStyleForRowAtIndexPath:(NSIndexPath *)indexPath  

- (BOOL)tableView:(UITableView *)tableView shouldIndentWhileEditingRowAtIndexPath:(NSIndexPath *)indexPath  

You can use the selected value of the list somewhere else, may be in the next viewController.

0

精彩评论

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