该方法写在Cell中即可
// 改变滑动删除按钮样式
- (void)layoutSubviews {
[super layoutSubviews];
for (UIView *subView in self.subviews){
if([subView isKindOfClass:NSClassFromString(@"UITableViewCellDeleteConfirmationView")]) {
UIView *confirmView = (UIView *)[subView.subviews lastObject];//删除是第一个元素,置顶是第二个
for(UIView *sub in confirmView.subviews){
if([sub isKindOfClass:NSClassFromString(@"UIButtonLabel")]){
UILabel *deleteLabel = (UILabel *)sub;
// 改置顶按钮的字体
if ([deleteLabel.text isEqualToString:@"置顶"] || [deleteLabel.text isEqualToString:@"取消置顶"] ) {
deleteLabel.textColor = [UIColor whiteColor];
return;
}
}
}
}
}
}
网友评论