Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Binary file modified Example/.DS_Store
Binary file not shown.
8 changes: 8 additions & 0 deletions Example/Pods/Pods.xcodeproj/project.pbxproj

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 1 addition & 2 deletions Example/TBPerformanceView/PVViewController.m
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,7 @@ - (void)viewDidLoad
[super viewDidLoad];
self.view.backgroundColor = [UIColor redColor];
[[TBPerformanceBoard sharedInstance] startWorkingOnViewController:self];
[[TBPerformanceBoard sharedInstance] open];
// Do any additional setup after loading the view, typically from a nib.
// Do any additional setup after loading the view, typically from a nib.
}

- (void)didReceiveMemoryWarning
Expand Down
43 changes: 40 additions & 3 deletions TBPerformanceView/Classes/TBPerformanceBoard.m
Original file line number Diff line number Diff line change
Expand Up @@ -17,11 +17,15 @@
//#import "TBNetReachability.h"
//#import "AppDelegate.h"
#import "TBBoardView.h"
#import "TBCricleView.h"

#define kCtricleHeight 110

typedef NS_ENUM(NSInteger, PerformanceBoardType) {
PB_Normarl = 0, // no button type
PB_DeviceInfo,
PB_Detail,
PB_Circle,

};

Expand Down Expand Up @@ -113,8 +117,9 @@ - (void)startWorkingOnViewController:(UIViewController *)ctr {
_displayLink.paused = YES;
}


[self createShowView:ctr.view];
_type = PB_Circle;

[self createCricleView:ctr.view];

[[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(applicationDidBecomeActiveNotification:) name:UIApplicationDidBecomeActiveNotification object:nil];

Expand Down Expand Up @@ -183,6 +188,31 @@ - (void)pushToDetail {
}
}



// 简单数据圆形
- (void)createCricleView:(UIView *)view{
if (view && ![view viewWithTag:1001]) {
TBCricleView *topView = [[TBCricleView alloc] initWithFrame:CGRectMake(1, 150,kCtricleHeight, kCtricleHeight)];
[topView setBackgroundColor:[UIColor colorWithRed:0.0 green:0.0 blue:0.0 alpha:0.5]];
topView.layer.cornerRadius = 4;
topView.layer.masksToBounds = YES;
topView.tag = 1001;

if (view) {
[view addSubview:topView];
}else {
UIWindow *w = [[UIApplication sharedApplication] keyWindow];
[w addSubview:topView];
}
UILabel *l = [self labelWithFontSize:12 FontColor:[UIColor whiteColor] frame:CGRectMake(0, 0, kCtricleHeight, kCtricleHeight) Text:@""];
l.textAlignment = NSTextAlignmentCenter;
self.topLabel = l;
[topView addSubview:l];
}
}

// 长条形状 方便更多数据
- (void)createShowView:(UIView *)view{
if (view && ![view viewWithTag:1001]) {
TBBoardView *topView = [[TBBoardView alloc] initWithFrame:CGRectMake(1, 150, [UIScreen mainScreen].bounds.size.width - 2, self.type == PB_DeviceInfo? 50: 25)];
Expand Down Expand Up @@ -239,7 +269,14 @@ - (void)takeReadingsFromFps:(CGFloat)fps {
_topLabel.frame = CGRectMake(0, 0, [UIScreen mainScreen].bounds.size.width - 100, 50);
_topLabel.numberOfLines = 0;
_topLabel.textAlignment = NSTextAlignmentCenter;
}else {
} else if (_type == PB_Circle) {

_topLabel.frame = CGRectMake(0, 0, kCtricleHeight,kCtricleHeight);
_topLabel.numberOfLines = 0;
_topLabel.textAlignment = NSTextAlignmentCenter;
string = [NSString stringWithFormat:@"CPU:%0.2f%% \n Memory:%0.2fMb \n FPS:%0.2f \n AppVersion:%@ \n iOS : %@",cpuUse,memeryUse,fps,app_version,ios_version];

} else {
string = [NSString stringWithFormat:@"CPU:%0.2f%%; MEMERY:%0.2fMb; FPS:%0.2f",cpuUse,memeryUse,fps];
}

Expand Down
16 changes: 16 additions & 0 deletions UserInterface/TBCricleView.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
//
// TBCricleView.h
// TBPerformanceView
//
// Created by BinTong on 2019/8/18.
//

#import <UIKit/UIKit.h>

NS_ASSUME_NONNULL_BEGIN

@interface TBCricleView : UIView

@end

NS_ASSUME_NONNULL_END
39 changes: 39 additions & 0 deletions UserInterface/TBCricleView.m
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
//
// TBCricleView.m
// TBPerformanceView
//
// Created by BinTong on 2019/8/18.
//

#import "TBCricleView.h"

@interface TBCricleView ()

@property (nonatomic, assign) CGFloat left;
@property (nonatomic, assign) CGFloat top;

@end

@implementation TBCricleView
#pragma mark - touch delegate
-(void)touchesBegan:(NSSet<UITouch *> *)touches withEvent:(UIEvent *)event{
UITouch *touch = [touches anyObject];
CGPoint point = [touch locationInView:self];
_left = point.x;
_top = point.y;
}

-(void)touchesMoved:(NSSet<UITouch *> *)touches withEvent:(UIEvent *)event{
UITouch *touch = [touches anyObject];
CGPoint point = [touch locationInView:self.window];
self.frame = CGRectMake(point.x- _left, point.y - _top, self.frame.size.width, self.frame.size.height);
CGPoint topPoint = [touch locationInView:self.window];
// [self.boardView topView:self.boardView.window Point:topPoint];

}

- (void)touchesEnded:(NSSet<UITouch *> *)touches withEvent:(UIEvent *)event {

}
@end