ShowBtn.m 4.0 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879
  1. //
  2. // ShowBtn.m
  3. // smartRhino
  4. //
  5. // Created by niuzhen on 2020/2/26.
  6. // Copyright © 2020 tederen. All rights reserved.
  7. //
  8. #import "ShowBtn.h"
  9. @implementation ShowBtn
  10. - (instancetype)init
  11. {
  12. self = [super init];
  13. if (self) {
  14. }
  15. return self;
  16. }
  17. - (void)setLabelTitle:(NSString *)title
  18. {
  19. self.title = [NSString stringWithFormat:@"%@ ",title];
  20. NSMutableAttributedString * attStr = [[NSMutableAttributedString alloc] initWithString:self.title attributes:@{NSFontAttributeName:[UIFont systemFontOfSize:17],NSForegroundColorAttributeName:UIColorHex(0x000000)}];
  21. NSTextAttachment *attach = [[NSTextAttachment alloc] init];
  22. attach.image = [UIImage imageNamed:@"chatmsg_notice_showAll_icon"];
  23. NSAttributedString *collegeStr = [NSAttributedString attributedStringWithAttachment:attach];
  24. [attStr appendAttributedString:collegeStr];
  25. [attStr appendAttributedString:[[NSAttributedString alloc] initWithString:@" "]];
  26. [self setAttributedTitle:attStr forState:UIControlStateNormal];
  27. }
  28. - (void)show
  29. {
  30. NSMutableAttributedString * attStr = [[NSMutableAttributedString alloc] initWithString:self.title attributes:@{NSFontAttributeName:[UIFont systemFontOfSize:17],NSForegroundColorAttributeName:UIColorHex(0x000000)}];
  31. NSTextAttachment *attach = [[NSTextAttachment alloc] init];
  32. attach.image = [UIImage imageNamed:@"chatmsg_notice_hideAll_icon"];
  33. NSAttributedString *collegeStr = [NSAttributedString attributedStringWithAttachment:attach];
  34. [attStr appendAttributedString:collegeStr];
  35. [self setAttributedTitle:attStr forState:UIControlStateNormal];
  36. }
  37. - (void)dismiss
  38. {
  39. NSMutableAttributedString * attStr = [[NSMutableAttributedString alloc] initWithString:self.title attributes:@{NSFontAttributeName:[UIFont systemFontOfSize:17],NSForegroundColorAttributeName:UIColorHex(0x000000)}];
  40. NSTextAttachment *attach = [[NSTextAttachment alloc] init];
  41. attach.image = [UIImage imageNamed:@"chatmsg_notice_showAll_icon"];
  42. NSAttributedString *collegeStr = [NSAttributedString attributedStringWithAttachment:attach];
  43. [attStr appendAttributedString:collegeStr];
  44. [self setAttributedTitle:attStr forState:UIControlStateNormal];
  45. }
  46. - (void)setcomTitle:(NSString *)title
  47. {
  48. self.title = [NSString stringWithFormat:@"%@ ",title];
  49. NSMutableAttributedString * attStr = [[NSMutableAttributedString alloc] initWithString:self.title attributes:@{NSFontAttributeName:[UIFont systemFontOfSize:14],NSForegroundColorAttributeName:UIColorHex(0x666666)}];
  50. NSTextAttachment *attach = [[NSTextAttachment alloc] init];
  51. attach.image = [UIImage imageNamed:@"chatmsg_notice_showAll_icon"];
  52. NSAttributedString *collegeStr = [NSAttributedString attributedStringWithAttachment:attach];
  53. [attStr appendAttributedString:collegeStr];
  54. [attStr appendAttributedString:[[NSAttributedString alloc] initWithString:@" "]];
  55. [self setAttributedTitle:attStr forState:UIControlStateNormal];
  56. }
  57. - (void)showCom
  58. {
  59. NSMutableAttributedString * attStr = [[NSMutableAttributedString alloc] initWithString:self.title attributes:@{NSFontAttributeName:[UIFont systemFontOfSize:14],NSForegroundColorAttributeName:UIColorHex(0x666666)}];
  60. NSTextAttachment *attach = [[NSTextAttachment alloc] init];
  61. attach.image = [UIImage imageNamed:@"chatmsg_notice_hideAll_icon"];
  62. NSAttributedString *collegeStr = [NSAttributedString attributedStringWithAttachment:attach];
  63. [attStr appendAttributedString:collegeStr];
  64. [self setAttributedTitle:attStr forState:UIControlStateNormal];
  65. }
  66. - (void)dismissCom
  67. {
  68. NSMutableAttributedString * attStr = [[NSMutableAttributedString alloc] initWithString:self.title attributes:@{NSFontAttributeName:[UIFont systemFontOfSize:14],NSForegroundColorAttributeName:UIColorHex(0x666666)}];
  69. NSTextAttachment *attach = [[NSTextAttachment alloc] init];
  70. attach.image = [UIImage imageNamed:@"chatmsg_notice_showAll_icon"];
  71. NSAttributedString *collegeStr = [NSAttributedString attributedStringWithAttachment:attach];
  72. [attStr appendAttributedString:collegeStr];
  73. [self setAttributedTitle:attStr forState:UIControlStateNormal];
  74. }
  75. @end