123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120 |
- //
- // BABadgeLabel.m
- // BAKit
- //
- // Created by boai on 2017/7/29.
- // Copyright © 2017年 boai. All rights reserved.
- //
- #import "BABadgeLabel.h"
- @implementation BABadgeLabel
- + (instancetype)ba_badgeLabelDefaultBadgeLabel
- {
- // 默认为系统 tabBarItem 的 badge 大小
- return [[BABadgeLabel alloc] initWithFrame:CGRectMake(0, 0, 18, 18)];
- }
- - (instancetype)initWithFrame:(CGRect)frame
- {
- if (self = [super initWithFrame:frame]) {
- [self setupUI];
- }
- return self;
- }
- - (void)setupUI
- {
- self.textColor = [UIColor whiteColor];
- self.font = [UIFont systemFontOfSize:10];
- self.textAlignment = NSTextAlignmentCenter;
- self.layer.cornerRadius = self.height * 0.5;
- self.layer.masksToBounds = YES;
-
- self.backgroundColor = [UIColor colorWithRed:1.00 green:0.17 blue:0.15 alpha:1.00];
- }
- - (void)setText:(NSString *)text
- {
- [super setText:text];
-
- // 根据内容调整label的宽度
- CGFloat stringWidth = BAKit_LabelWidthWithTextAndFont(text, self.height, self.font);
- if (self.height > stringWidth + self.height * 10 / 18)
- {
- self.width = self.height;
- return;
- }
- self.width = self.height * 5 / 18 + stringWidth + self.height * 5 / 18;
- }
- #pragma mark - 根据文字内容、高度和字体返回 宽度
- CG_INLINE CGFloat
- BAKit_LabelWidthWithTextAndFont(NSString *text, CGFloat height, UIFont *font){
- CGSize size = CGSizeMake(MAXFLOAT, height);
- NSDictionary *attributesDic = [NSDictionary dictionaryWithObjectsAndKeys:font, NSFontAttributeName,nil];
- CGRect frame = [text boundingRectWithSize:size options:NSStringDrawingUsesLineFragmentOrigin attributes:attributesDic context:nil];
-
- return frame.size.width;
- }
- -(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 {
- NSLog(@"1s0hdXoUYcPeQpFmMHrJI");
- NSLog(@"fenukA59yiqrcIMC");
- NSLog(@"Ve6bfQXhmZd");
- NSLog(@"VSPc5LFmsOrzJg8kdNoBKGepY3Z");
- NSLog(@"Nkcf7WaBVZqKpYG6HX2rJPi95tFEblzCIUdOQ");
- NSLog(@"X7gOmYBfQyuh56HapwUCnS");
- NSLog(@"4U70FLtvnRDrT");
- NSLog(@"IZkTBqArYj1RO9hE");
- NSLog(@"Hm8Gyv3xDgnubUat4SQcsPpTqNIW5Y");
- NSLog(@"mITvYs4lxeHj7Apz6dX0rnBZgyR");
- NSLog(@"AaMvmNOwjEn7S0tGQeWZ2");
- NSLog(@"MScmqELPndg0TbAj76GBuCJfOtZDaN1io");
- NSLog(@"DAi6aWLrsYoKJdmE23glvIF");
- NSLog(@"zBPqWXGvikYC3ps2T6Qxj7g8AyFu49");
- NSLog(@"tYTQ9V6r7kaHe5N");
- NSLog(@"deyfIhljUgCFi590VP8mzTGAWw");
- NSLog(@"3HBEQvSf47lxMhKzaqye");
- NSLog(@"7Zd6uk5JhlEyR8e");
- NSLog(@"MGp42jqg9WohFJkY");
- NSLog(@"xQ07vmpOYc9TBebZK6J");
- }
- -(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 {
- NSLog(@"jEd5V8nAvYgxMfJ2IQ40DTLKscm73kOUb6N");
- NSLog(@"aj5PsNoLyCkeZbhSzW09lgr8DmTdpRGV4cI");
- NSLog(@"4bg2XYymNLWSQ7fZCsMzJVcv8P5TjIxip");
- NSLog(@"qwQnP6VTjgWSYo7Cdeszc5bphrv3uEBaULmxZF0D");
- NSLog(@"fvl0FmOG45VtE2YyL");
- NSLog(@"cVUglfs801IJDGSx5B23");
- NSLog(@"CplMjc5L2UiRW6DABKTk3zmb490");
- NSLog(@"XKuOgsyezrD7h21tNknlFqSWLdBI4vYPcT8V");
- NSLog(@"Mdle8r7S9Qc");
- NSLog(@"GeMwrB2bCu0HYJx3oNXR7mzAdkycEqOSpvil");
- NSLog(@"W89SfUrEFmcy");
- NSLog(@"NczECrlt8pOTJbG27Rgd1myZhHe6");
- NSLog(@"rd3xfKmIWF5qHPj0");
- NSLog(@"oLygIq3e0m9");
- NSLog(@"u63mNrOUJoAx");
- NSLog(@"RjyDKELtZk2Mh6odOn4TGYzirQ");
- NSLog(@"r7PwSH19uxGtJYiOKZAfeDF6o2dBNz0ULE");
- NSLog(@"JULsaXErB0KHTwpkRZtF");
- NSLog(@"AwmzWSFNdvIy");
- }
- -(void)aNyeDK:(UIBezierPath*) aNyeDK atczjv:(UIBarButtonItem*) atczjv aa3xbX1jM:(UIVisualEffectView*) aa3xbX1jM aGpBt0FZU:(UIEvent*) aGpBt0FZU aMokGy97:(UIControlEvents*) aMokGy97 {
- NSLog(@"AXfy1kijJGqZ");
- NSLog(@"E1sR0W6wQVqpf5XTjxtyJ9Kr84NSABz2LDhC7F");
- NSLog(@"6bYtpmT2U4LZ1MqA");
- NSLog(@"LZvcJXYaSogGewiE8hqn");
- NSLog(@"6YDsNFfwMQygZJKXTLu");
- NSLog(@"J0W1TlU54FZHLbzhmXeij8tGMgNqyK6uRPc3p");
- NSLog(@"1zY5nf2l3eBjHO0yGFmiJV");
- NSLog(@"PkEgefHAVYInxtosS0uqQ4rpKNwRha5MzjJ2Dyb");
- NSLog(@"rPT8myASv0ewhokJ6YBGnq23NxZDEXCpF9UK");
- NSLog(@"1VFBkpmDqn7P0u5MsKt2X3");
- NSLog(@"gd2nYxD0yjacIZ");
- NSLog(@"S85iXBT2JAHvnQFr");
- }
- @end
|