Advertisement
Guest User

Untitled

a guest
Jul 25th, 2017
76
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.79 KB | None | 0 0
  1. - (void)setSelected:(BOOL)selected animated:(BOOL)animated {
  2. [super setSelected:selected animated:animated];
  3.  
  4. if (selected) {
  5. if (self.isEditing) {
  6. self.customLabel.backgroundColor = [UIColor blueColor];
  7. }
  8. else {
  9. self.customLabel.backgroundColor = [UIColor blueColor];
  10. }
  11. }
  12. else {
  13. self.customLabel.backgroundColor = [UIColor blueColor];
  14. }
  15. }
  16.  
  17. - (void)setHighlighted:(BOOL)highlighted animated:(BOOL)animated {
  18. [super setHighlighted:highlighted animated:animated];
  19.  
  20. if (highlighted) {
  21. if (self.isEditing) {
  22. self.customLabel.backgroundColor = [UIColor blueColor];
  23. }
  24. else {
  25. self.customLabel.backgroundColor = [UIColor blueColor];
  26. }
  27. }
  28. else {
  29. self.customLabel.backgroundColor = [UIColor blueColor];
  30. }
  31. }
  32.  
  33. - (void)setEditing:(BOOL)editing animated:(BOOL)animated {
  34. [super setEditing:editing animated:animated];
  35.  
  36. if (editing) {
  37. self.customLabel.backgroundColor = [UIColor blueColor];
  38. }
  39. else {
  40. self.customLabel.backgroundColor = [UIColor blueColor];
  41. }
  42. }
  43.  
  44. @interface VALAbel:UILabel
  45. @property (nonatomic, strong) UIColor *bac_color;
  46. @end
  47.  
  48.  
  49. @implementation VALabel
  50.  
  51. -(void)setBac_color:(UIColor *)bac_color
  52. {
  53. _bac_color = bac_color;
  54. [self setNeedsDisplay];
  55. }
  56.  
  57. - (void)drawRect:(CGRect)rect {
  58. [self.bac_color set];
  59.  
  60. CGContextSetShouldAntialias(UIGraphicsGetCurrentContext(), true);
  61. CGContextFillRect(UIGraphicsGetCurrentContext(), self.bounds);
  62.  
  63. [super drawRect:rect];
  64. }
  65. @end
  66.  
  67. import UIKit
  68.  
  69. class NeverClearView: UIView {
  70. override var backgroundColor: UIColor? {
  71. didSet {
  72. if backgroundColor?.cgColor.alpha == 0 {
  73. backgroundColor = oldValue
  74. }
  75. }
  76. }
  77. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement