优雅实现自定义cell删除按钮样式
作者:
闻道刘 | 来源:发表于
2016-10-14 04:21 被阅读69次// Created by Eric.
// Copyright © 2016年 Eric. All rights reserved.
//
#import "MemberCell.h"
@implementation MembeTableViewCell
- (void)layoutSubviews {
[super layoutSubviews];
UIView *view = nil;
for (UIView *v in self.subviews) {
if ([v isKindOfClass:NSClassFromString(@"UITableViewCellDeleteConfirmationView")]) {
view = v;
break;
}
}
if (view.subviews.count) {
UIButton *button = view.subviews[0];
if (button) {
//自己设定颜色
button.backgroundColor = RGBACOLOR(255, 102, 64, 1);
//这个字符串的长度控制了删除按钮的宽度
[button setTitle:@" " forState:UIControlStateNormal];
//背景图什么的
[button setImage:[UIImage imageNamed:@"deleteAddress"] forState:UIControlStateNormal];
}
}
}
本文标题:优雅实现自定义cell删除按钮样式
本文链接:https://www.haomeiwen.com/subject/xqhwyttx.html
网友评论