在UITableViewCell上设置编辑样式 [英] Setting the editing style on a UITableViewCell
问题描述
我想在Cocoa Touch(iPhone)应用程序中设置UITableViewCell的编辑样式属性。
I'm trying to set the editing style property of a UITableViewCell in a Cocoa Touch (iPhone) app.
有关这种情况的示例,请查看Contacts应用程序,您可以在其中看到一些单元格左侧的小绿色加号。
For an example of what this looks like, check out the Contacts app, where you can see the little green plus sign to the left of some of the cells.
Interface Builder中的UITableViewCell检查器有一个编辑风格下拉,但它似乎没有做任何事情。
The UITableViewCell inspector in Interface Builder has an editing style drop down, but it doesn't seem to do anything.
同样,对于一个似乎无法工作的UITableViewCell,也有一个名为-setEditingStyle的无记录方法的CodeSense完成。
Likewise there is a CodeSense completion of an undocumented method called -setEditingStyle: for a UITableViewCell that doesn't seem to work either.
这是表视图数据源中的设置吗?
Is this a setting in the table view data source? Has anyone outside of Apple gotten this to work?
推荐答案
这是UITableViewDelegate中的一个方法:
It is indeed a method in the UITableViewDelegate:
- (UITableViewCellEditingStyle)tableView:(UITableView *)tableView editingStyleForRowAtIndexPath:(NSIndexPath *)indexPath
现在我得到一行绿色加号!
Now I get a row of green plus signs!
这篇关于在UITableViewCell上设置编辑样式的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!