至于怎么實(shí)現(xiàn)側(cè)滑那些就不說(shuō)了(太簡(jiǎn)單)藤为,主要說(shuō)一下側(cè)滑按鈕的樣式修改
1.首先要自定義cell
2.在自定義cell中的layout方法中找到側(cè)滑按鈕并進(jìn)行操作即可
//修改刪除按鈕
-(void)layoutSubviews {
[super layoutSubviews];
for (UIView *subView in self.subviews) {
if([subView isKindOfClass:NSClassFromString(@"UITableViewCellDeleteConfirmationView")]) {
//這里修改盛放按鈕的view的背景顏色(這里一般設(shè)置為和你的底色相同的顏色用于遮蓋掉原來(lái)的大紅色)
subView.backgroundColor = [UIColor hexColorStr:commonBGcolor];
//這里修改按鈕的frame 及 顏色(這里是你要設(shè)置成的按鈕顏色)
UIView *confirmView=(UIView *)[subView.subviews firstObject];
CGRect confFrame = confirmView.frame;
confFrame.size.height = 77;
confFrame.origin.y = 5;
confirmView.frame = confFrame;
confirmView.layer.backgroundColor = [UIColor hexColorStr:WX_ZSB_StyleColor].CGColor;
confirmView.layer.cornerRadius = 5;
//這里修改字的大小怪与、顏色,這個(gè)方法可以修改文字樣式
for(UIView *sub in confirmView.subviews) {
if ([sub isKindOfClass:NSClassFromString(@"UIButtonLabel")]) {
UILabel *deleteLabel=(UILabel *)sub;
//改刪除按鈕的字體大小
deleteLabel.font=[UIFont boldSystemFontOfSize:20];
//改刪除按鈕的文字
deleteLabel.text=@"刪除";
}
}
break;
}
}
}