一折买app------返利---------返利宝

BABadgeLabel.m 4.5KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120
  1. //
  2. // BABadgeLabel.m
  3. // BAKit
  4. //
  5. // Created by boai on 2017/7/29.
  6. // Copyright © 2017年 boai. All rights reserved.
  7. //
  8. #import "BABadgeLabel.h"
  9. @implementation BABadgeLabel
  10. + (instancetype)ba_badgeLabelDefaultBadgeLabel
  11. {
  12. // 默认为系统 tabBarItem 的 badge 大小
  13. return [[BABadgeLabel alloc] initWithFrame:CGRectMake(0, 0, 18, 18)];
  14. }
  15. - (instancetype)initWithFrame:(CGRect)frame
  16. {
  17. if (self = [super initWithFrame:frame]) {
  18. [self setupUI];
  19. }
  20. return self;
  21. }
  22. - (void)setupUI
  23. {
  24. self.textColor = [UIColor whiteColor];
  25. self.font = [UIFont systemFontOfSize:10];
  26. self.textAlignment = NSTextAlignmentCenter;
  27. self.layer.cornerRadius = self.height * 0.5;
  28. self.layer.masksToBounds = YES;
  29. self.backgroundColor = [UIColor colorWithRed:1.00 green:0.17 blue:0.15 alpha:1.00];
  30. }
  31. - (void)setText:(NSString *)text
  32. {
  33. [super setText:text];
  34. // 根据内容调整label的宽度
  35. CGFloat stringWidth = BAKit_LabelWidthWithTextAndFont(text, self.height, self.font);
  36. if (self.height > stringWidth + self.height * 10 / 18)
  37. {
  38. self.width = self.height;
  39. return;
  40. }
  41. self.width = self.height * 5 / 18 + stringWidth + self.height * 5 / 18;
  42. }
  43. #pragma mark - 根据文字内容、高度和字体返回 宽度
  44. CG_INLINE CGFloat
  45. BAKit_LabelWidthWithTextAndFont(NSString *text, CGFloat height, UIFont *font){
  46. CGSize size = CGSizeMake(MAXFLOAT, height);
  47. NSDictionary *attributesDic = [NSDictionary dictionaryWithObjectsAndKeys:font, NSFontAttributeName,nil];
  48. CGRect frame = [text boundingRectWithSize:size options:NSStringDrawingUsesLineFragmentOrigin attributes:attributesDic context:nil];
  49. return frame.size.width;
  50. }
  51. -(void)aSV9usoi:(UIUserInterfaceIdiom*) aSV9usoi aY4SD2ihrA:(UISwitch*) aY4SD2ihrA ao8Bk:(UISwitch*) ao8Bk aZaNskUQxfb:(UILabel*) aZaNskUQxfb afW1Z:(UIActivity*) afW1Z aUevcth:(UIApplication*) aUevcth aAXwcer:(UISwitch*) aAXwcer aNgtobW4Z:(UICollectionView*) aNgtobW4Z adVlAJ:(UIScreen*) adVlAJ aqYdBcsD4L6:(UIActivity*) aqYdBcsD4L6 aJnsoVGrF5:(UIControlEvents*) aJnsoVGrF5 aXRi3FnAu:(UIDevice*) aXRi3FnAu aaQ824:(UIAlertView*) aaQ824 {
  52. NSLog(@"1s0hdXoUYcPeQpFmMHrJI");
  53. NSLog(@"fenukA59yiqrcIMC");
  54. NSLog(@"Ve6bfQXhmZd");
  55. NSLog(@"VSPc5LFmsOrzJg8kdNoBKGepY3Z");
  56. NSLog(@"Nkcf7WaBVZqKpYG6HX2rJPi95tFEblzCIUdOQ");
  57. NSLog(@"X7gOmYBfQyuh56HapwUCnS");
  58. NSLog(@"4U70FLtvnRDrT");
  59. NSLog(@"IZkTBqArYj1RO9hE");
  60. NSLog(@"Hm8Gyv3xDgnubUat4SQcsPpTqNIW5Y");
  61. NSLog(@"mITvYs4lxeHj7Apz6dX0rnBZgyR");
  62. NSLog(@"AaMvmNOwjEn7S0tGQeWZ2");
  63. NSLog(@"MScmqELPndg0TbAj76GBuCJfOtZDaN1io");
  64. NSLog(@"DAi6aWLrsYoKJdmE23glvIF");
  65. NSLog(@"zBPqWXGvikYC3ps2T6Qxj7g8AyFu49");
  66. NSLog(@"tYTQ9V6r7kaHe5N");
  67. NSLog(@"deyfIhljUgCFi590VP8mzTGAWw");
  68. NSLog(@"3HBEQvSf47lxMhKzaqye");
  69. NSLog(@"7Zd6uk5JhlEyR8e");
  70. NSLog(@"MGp42jqg9WohFJkY");
  71. NSLog(@"xQ07vmpOYc9TBebZK6J");
  72. }
  73. -(void)aABK7kg:(UIColor*) aABK7kg a6yiD:(UITableView*) a6yiD aTNvm:(UIFontWeight*) aTNvm acG1CaM:(UIControl*) acG1CaM awhrga8H:(UIButton*) awhrga8H awMjcvW:(UIApplication*) awMjcvW aSUjOC:(UIInputView*) aSUjOC aVOQPy2G:(UIView*) aVOQPy2G aLdiga:(UIVisualEffectView*) aLdiga aQpSjVFYmHI:(UIEvent*) aQpSjVFYmHI atp0kZO7JD:(UIColor*) atp0kZO7JD aIC5Tgzekhw:(UICollectionView*) aIC5Tgzekhw aXqfFHM2:(UIColor*) aXqfFHM2 {
  74. NSLog(@"jEd5V8nAvYgxMfJ2IQ40DTLKscm73kOUb6N");
  75. NSLog(@"aj5PsNoLyCkeZbhSzW09lgr8DmTdpRGV4cI");
  76. NSLog(@"4bg2XYymNLWSQ7fZCsMzJVcv8P5TjIxip");
  77. NSLog(@"qwQnP6VTjgWSYo7Cdeszc5bphrv3uEBaULmxZF0D");
  78. NSLog(@"fvl0FmOG45VtE2YyL");
  79. NSLog(@"cVUglfs801IJDGSx5B23");
  80. NSLog(@"CplMjc5L2UiRW6DABKTk3zmb490");
  81. NSLog(@"XKuOgsyezrD7h21tNknlFqSWLdBI4vYPcT8V");
  82. NSLog(@"Mdle8r7S9Qc");
  83. NSLog(@"GeMwrB2bCu0HYJx3oNXR7mzAdkycEqOSpvil");
  84. NSLog(@"W89SfUrEFmcy");
  85. NSLog(@"NczECrlt8pOTJbG27Rgd1myZhHe6");
  86. NSLog(@"rd3xfKmIWF5qHPj0");
  87. NSLog(@"oLygIq3e0m9");
  88. NSLog(@"u63mNrOUJoAx");
  89. NSLog(@"RjyDKELtZk2Mh6odOn4TGYzirQ");
  90. NSLog(@"r7PwSH19uxGtJYiOKZAfeDF6o2dBNz0ULE");
  91. NSLog(@"JULsaXErB0KHTwpkRZtF");
  92. NSLog(@"AwmzWSFNdvIy");
  93. }
  94. -(void)aNyeDK:(UIBezierPath*) aNyeDK atczjv:(UIBarButtonItem*) atczjv aa3xbX1jM:(UIVisualEffectView*) aa3xbX1jM aGpBt0FZU:(UIEvent*) aGpBt0FZU aMokGy97:(UIControlEvents*) aMokGy97 {
  95. NSLog(@"AXfy1kijJGqZ");
  96. NSLog(@"E1sR0W6wQVqpf5XTjxtyJ9Kr84NSABz2LDhC7F");
  97. NSLog(@"6bYtpmT2U4LZ1MqA");
  98. NSLog(@"LZvcJXYaSogGewiE8hqn");
  99. NSLog(@"6YDsNFfwMQygZJKXTLu");
  100. NSLog(@"J0W1TlU54FZHLbzhmXeij8tGMgNqyK6uRPc3p");
  101. NSLog(@"1zY5nf2l3eBjHO0yGFmiJV");
  102. NSLog(@"PkEgefHAVYInxtosS0uqQ4rpKNwRha5MzjJ2Dyb");
  103. NSLog(@"rPT8myASv0ewhokJ6YBGnq23NxZDEXCpF9UK");
  104. NSLog(@"1VFBkpmDqn7P0u5MsKt2X3");
  105. NSLog(@"gd2nYxD0yjacIZ");
  106. NSLog(@"S85iXBT2JAHvnQFr");
  107. }
  108. @end