Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- - (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
- import UIKit
- class NeverClearView: UIView {
- override var backgroundColor: UIColor? {
- didSet {
- if backgroundColor?.cgColor.alpha == 0 {
- backgroundColor = oldValue
- }
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement