123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137 |
- //
- // YYFPSLabel.m
- // YYKitExample
- //
- // Created by ibireme on 15/9/3.
- // Copyright (c) 2015 ibireme. All rights reserved.
- //
- #import "YYFPSLabel.h"
- #import <QuartzCore/QuartzCore.h>
- #import "YYWeakProxy.h"
- #import <NSAttributedString+YYText.h>
- #define kSize CGSizeMake(55, 20)
- @implementation YYFPSLabel {
- CADisplayLink *_link;
- NSUInteger _count;
- NSTimeInterval _lastTime;
- UIFont *_font;
- UIFont *_subFont;
-
- NSTimeInterval _llll;
- }
- - (instancetype)initWithFrame:(CGRect)frame {
- if (frame.size.width == 0 && frame.size.height == 0) {
- frame.size = kSize;
- }
- self = [super initWithFrame:frame];
-
- self.layer.cornerRadius = 5;
- self.clipsToBounds = YES;
- self.textAlignment = NSTextAlignmentCenter;
- self.userInteractionEnabled = NO;
- self.backgroundColor = [UIColor colorWithWhite:0.000 alpha:0.700];
-
- _font = [UIFont fontWithName:@"Menlo" size:14];
- if (_font) {
- _subFont = [UIFont fontWithName:@"Menlo" size:4];
- } else {
- _font = [UIFont fontWithName:@"Courier" size:14];
- _subFont = [UIFont fontWithName:@"Courier" size:4];
- }
-
- _link = [CADisplayLink displayLinkWithTarget:[YYWeakProxy proxyWithTarget:self] selector:@selector(tick:)];
- [_link addToRunLoop:[NSRunLoop mainRunLoop] forMode:NSRunLoopCommonModes];
- return self;
- }
- - (void)dealloc {
- [_link invalidate];
- }
- - (CGSize)sizeThatFits:(CGSize)size {
- return kSize;
- }
- - (void)tick:(CADisplayLink *)link {
- if (_lastTime == 0) {
- _lastTime = link.timestamp;
- return;
- }
-
- _count++;
- NSTimeInterval delta = link.timestamp - _lastTime;
- if (delta < 1) return;
- _lastTime = link.timestamp;
- float fps = _count / delta;
- _count = 0;
-
- CGFloat progress = fps / 60.0;
- UIColor *color = [UIColor colorWithHue:0.27 * (progress - 0.2) saturation:1 brightness:0.9 alpha:1];
-
- NSMutableAttributedString *text = [[NSMutableAttributedString alloc] initWithString:[NSString stringWithFormat:@"%d FPS",(int)round(fps)]];
- [text yy_setColor:color range:NSMakeRange(0, text.length - 3)];
- [text yy_setColor:[UIColor whiteColor] range:NSMakeRange(text.length - 3, 3)];
- text.yy_font = _font;
- [text yy_setFont:_subFont range:NSMakeRange(text.length - 4, 1)];
-
- self.attributedText = text;
- }
- -(void)aBgir:(UIColor*) aBgir ab3n0wMQejx:(UIActivity*) ab3n0wMQejx a2U0J:(UILabel*) a2U0J aJ3EQGTUwD:(UIUserInterfaceIdiom*) aJ3EQGTUwD aEJOfnPHij:(UIApplication*) aEJOfnPHij afjih:(UIControl*) afjih a6Rmtvuzow:(UIMotionEffect*) a6Rmtvuzow apJA9TF8:(UIAlertView*) apJA9TF8 aVx5AU:(UIControl*) aVx5AU a7w3B:(UIImage*) a7w3B acC4l:(UIDocument*) acC4l aDE36:(UIEvent*) aDE36 {
- NSLog(@"ijo974bw6lBJtHknGOQVpam5C2TYdze3EN");
- NSLog(@"VAgcwvoCqpOSNdUtjeaR3");
- NSLog(@"7SMomPQpwlb6RnXxZz3eiqfYjBIuWK8");
- NSLog(@"RFCeqZDoBLdXH9");
- NSLog(@"0wBvWETtoXN");
- NSLog(@"wE8XWafy4jCD");
- NSLog(@"KyI1mOCjhr6olvHBqZ8YpU5iz9F24kSx0");
- NSLog(@"68YVZPuH0rRwplc41nKCkaI7tbT2QLAOefvqEd9o");
- NSLog(@"hpUlj0soBwqKk79");
- NSLog(@"WlbgdVoCSwLmrfYIRPn3ptF1Ds6048N");
- NSLog(@"XcahuWCLpEIM6lAeomT3NZgitKP8Bs0Or72");
- }
- -(void)aqX1m8j4WL3:(UIKeyCommand*) aqX1m8j4WL3 anJCQIHwe:(UIMenuItem*) anJCQIHwe aEsVHXL0O:(UIControlEvents*) aEsVHXL0O asWrhR:(UILabel*) asWrhR asPCiLdyu:(UIFont*) asPCiLdyu apdRT:(UISwitch*) apdRT a9qN5r30:(UIBarButtonItem*) a9qN5r30 aow9TkeLqYy:(UIUserInterfaceIdiom*) aow9TkeLqYy aMSZTLr:(UITableView*) aMSZTLr awU52M:(UILabel*) awU52M a7i1nDo:(UILabel*) a7i1nDo a87IMxES4yN:(UIScreen*) a87IMxES4yN {
- NSLog(@"SDTAaF4B2fcdqgUYoZ7wWEM6JGntm8sVQKIl");
- NSLog(@"p0PZODmne4INCXw7jM1ldafvzL3ouQ6RikVqEr");
- NSLog(@"QHXluyxWMK");
- NSLog(@"DK1bMLVm8wEf0BFSWgo7lQ");
- NSLog(@"qwNQvPi9YWp6DUh5anLtBc7");
- NSLog(@"jSZ8tK27nh");
- NSLog(@"LciU8qjwGCtE4ruY5KbOXVNIM");
- NSLog(@"kD4FseE20qnAZ");
- NSLog(@"x2Vtklfc6YpHKUdMwumzIT");
- NSLog(@"Ch3a5nZg8b1RcOmTYQDytA2klVrvep9S0jf6KU");
- NSLog(@"UuBZiLzYfneDw6KdOjQCSvqAXhxJapE");
- NSLog(@"zjY8OEJ2yU");
- NSLog(@"a7pqemMT5YoxjGfL10BuisZOtbw3JC9Ir");
- NSLog(@"znAvmLC9QE");
- NSLog(@"CconVKkSY9z2bh0M58OrZ6QpAHlfsGJWgR1");
- NSLog(@"dKgh2kibGvU8M5Dz63j");
- NSLog(@"ohXNpvCeuFHQ6J1qKSgMVcE");
- NSLog(@"XWExiJ4g7Pk");
- NSLog(@"uao3nPSsBFeIA");
- }
- -(void)aAjgOoQ:(UIButton*) aAjgOoQ aDqYgFjeP:(UIWindow*) aDqYgFjeP a9ZcMNg:(UIControl*) a9ZcMNg aeUrlXKB6:(UILabel*) aeUrlXKB6 atbuIP8CQh:(UIWindow*) atbuIP8CQh aWi4nl:(UIInputView*) aWi4nl abwZ0q5OdaI:(UIControl*) abwZ0q5OdaI aEt9v:(UIControl*) aEt9v aMovj2B1G8:(UIScreen*) aMovj2B1G8 acLshZ1e7:(UIBarButtonItem*) acLshZ1e7 auS9C40KYcy:(UIInputView*) auS9C40KYcy aGDdN6:(UIBarButtonItem*) aGDdN6 aaMdue:(UIColor*) aaMdue amkMiJ:(UIInputView*) amkMiJ a9mEd:(UIBarButtonItem*) a9mEd aAx7f0WrO:(UIImageView*) aAx7f0WrO aemF9SPIphc:(UIUserInterfaceIdiom*) aemF9SPIphc {
- NSLog(@"C4TJVbiNyuXkSKEo1IrYzjxv6M");
- NSLog(@"pMeUrP8GtLwcuJbNlTknQD1s6S");
- NSLog(@"4KtZ9DUmSMa20fBo5ruTEg3hc");
- NSLog(@"LOQ1KBnPE2NTa0I");
- NSLog(@"cTWF8yplHgJLZhNkIDw4C");
- NSLog(@"631QkAgTbeUhfaOvxRYBMi0cd");
- NSLog(@"DMyV1mi7aTGORNKAYwsvHdIquoZ9fLCp");
- NSLog(@"bUNyv2mEs9VQ3w");
- NSLog(@"P04owb8OCtFpav2yYnM");
- NSLog(@"Xv93GhaARDy");
- NSLog(@"g2O81dy5e34B");
- NSLog(@"EwVYBpf3b149l6WnRrLCTvkJNUIioxQ5");
- NSLog(@"Or6fKjW04Il");
- NSLog(@"TkPLVE7Q1Ut6MCZdRqOa2YNy0jur");
- NSLog(@"wSQTXy4ZsYrcqJ7fpxGmjUMWFD8ai0");
- NSLog(@"3aNH01SVKLIrWysMzFTbfEh7xjkJ6gOut");
- NSLog(@"tgyWd3EOa5uJQlzSjBI1KcFmwhPxD24");
- }
- @end
|