大佬教程收集整理的这篇文章主要介绍了ios – UITableViewCell重新排序清除子视图的背景颜色,大佬教程大佬觉得挺不错的,现在分享给大家,也给大家做个参考。
@L_607_1@
Subviews of UITableViewCell are not visible while reordering
Reordering causing subview ‘s backround color to clear
我有一个@L_674_6@的tableview单元格,里面有UILabel.当tableview处于编辑模式并且我拖动单元格重新排序时,UILabel的背景变为清晰的颜色.我还发现,如果我尝试重新排序所选单元格(我的tableview允许在编辑模式下进行多次选择),则子视图的背景颜色会保留.
我在Customcatell中尝试了以下方法,但是当拖动单元格时,它们都没有覆盖子视图的背景颜色.
我希望子视图的背景颜色保持不变.有没有我错过的方法?或者Apple以这种方式设计它?
- (void)setSELEcted:(BOOL)SELEcted animated:(BOOL)animated { [super setSELEcted:SELEcted animated:animated]; if (SELEcted) { if (self.isEdiTing) { self.customLabel.BACkgroundColor = [UIColor blueColor]; } else { self.customLabel.BACkgroundColor = [UIColor blueColor]; } } else { self.customLabel.BACkgroundColor = [UIColor blueColor]; } } - (void)setHighlighted:(BOOL)highlighted animated:(BOOL)animated { [super setHighlighted:highlighted animated:animated]; if (highlighted) { if (self.isEdiTing) { self.customLabel.BACkgroundColor = [UIColor blueColor]; } else { self.customLabel.BACkgroundColor = [UIColor blueColor]; } } else { self.customLabel.BACkgroundColor = [UIColor blueColor]; } } - (void)setEdiTing:(BOOL)ediTing animated:(BOOL)animated { [super setEdiTing:ediTing animated:animated]; if (ediTing) { self.customLabel.BACkgroundColor = [UIColor blueColor]; } else { self.customLabel.BACkgroundColor = [UIColor blueColor]; } }
@interface VALAbel:UILabel @property (nonatomic,strong) UIColor *BAC_color; @end @implementation VALabel -(void)setBAC_color:(UIColor *)BAC_color { _BAC_color = BAC_color; [self setNeedsDisplay]; } - (void)drawRect:(CGRect)rect { [self.BAC_color set]; CGContextSetShouldAntialias(UIGraphicsGetCurrentContext(),truE); CGContextFillRect(UIGraphicsGetCurrentContext(),self.bounds); [super drawRect:rect]; } @end
这会对你有所帮助!
以上是大佬教程为你收集整理的ios – UITableViewCell重新排序清除子视图的背景颜色全部内容,希望文章能够帮你解决ios – UITableViewCell重新排序清除子视图的背景颜色所遇到的程序开发问题。
如果觉得大佬教程网站内容还不错,欢迎将大佬教程推荐给程序员好友。
本图文内容来源于网友网络收集整理提供,作为学习参考使用,版权属于原作者。
如您有任何意见或建议可联系处理。小编QQ:384754419,请注明来意。