Spi*_*ire 7 iphone xcode customization uibutton
我有"滑动删除"的功能TableViewCell.我想自定义删除按钮.
这可能,以及如何访问删除按钮?
Wub*_*bbe 12
如果您只需要更改按钮的标题,则只需添加titleForDeleteConfirmationButtonForRowAtIndexPath方法.
- (NSString *)tableView:(UITableView *)tableView titleForDeleteConfirmationButtonForRowAtIndexPath:(NSIndexPath *)indexPath {
return @"NewButtonName";
}
Run Code Online (Sandbox Code Playgroud)
用户执行滑动操作时将调用此方法
只需将其放入CustomCell即可
- (void)willTransitionToState:(UITableViewCellStateMask)state
{
[super willTransitionToState:state];
if ((state & UITableViewCellStateShowingDeleteConfirmationMask) == UITableViewCellStateShowingDeleteConfirmationMask)
{
for (UIView *subview in self.subviews)
{
if ([NSStringFromClass([subview class]) isEqualToString:@"UITableViewCellDeleteConfirmationControl"])
{
UIImageView *deleteBtn = [[UIImageView alloc]initWithFrame:CGRectMake(0, 0, 64, 33)];
[deleteBtn setImage:[UIImage imageNamed:@"arrow_left_s11.png"]];
[[subview.subviews objectAtIndex:0] addSubview:deleteBtn];
}
}
}
}
Run Code Online (Sandbox Code Playgroud)
你不应该尝试,你不应该改变Apple的默认视图.
| 归档时间: |
|
| 查看次数: |
17981 次 |
| 最近记录: |