C.J*_*hns 76 iphone delegates uitableview ios
嗨,我正在尝试更改用户在我的tableview中刷一个uitableviewcell时在删除按钮中显示的文本.
我在另一个问题线程中看到了一个例子,说明要使用这个tableview委托
- (NSString *)tableView:(UITableView *)tableView titleForDeleteConfirmationButtonForRowAtIndexPath:(NSIndexPath *)indexPath
Run Code Online (Sandbox Code Playgroud)
我的问题是,我如何使用这种方法..我不知道如何使用它.
Fai*_* S. 194
在你的控制器中管理UITableView
你应该实现UITableviewDelegate
并在方法中返回你想要的方法标题titleForDeleteConfirmationButtonForRowAtIndexPath
.
例:
@interface CategoryAddViewController : UITableViewController
@end
@implementation CategoryAddViewController
// ...
-(NSString *)tableView:(UITableView *)tableView titleForDeleteConfirmationButtonForRowAtIndexPath:(NSIndexPath *)indexPath {
return @"Please don't delete me!";
}
@end
Run Code Online (Sandbox Code Playgroud)
让你离开这样的事情:
Wel*_*les 30
在Swift中它是平等的,只是方法签名是不同的!
func tableView(tableView: UITableView, titleForDeleteConfirmationButtonForRowAtIndexPath indexPath: NSIndexPath) -> String? {
return "Erase"
}
Run Code Online (Sandbox Code Playgroud)
归档时间: |
|
查看次数: |
33025 次 |
最近记录: |