GDPerformanceView 1.3.1

GDPerformanceView 1.3.1

测试已测试
语言语言 Obj-CObjective C
许可证 MIT
发布最后发布2017年3月

Gavrilov Daniil 维护。



  • 作者:
  • Gavrilov Daniil

显示帧率、CPU 使用率、应用和 iOS 版本在状态栏之上,并通过代理报告帧率和 CPU 使用率。

Alt text Alt text Alt text Alt text

安装

简单地将 GDPerformanceMonitoring 文件夹及其文件添加到您的项目中,或者使用 CocoaPods。

Podfile

您可以通过将 GDPerformanceView 添加到您的 Podfile 中来使用 CocoaPods 安装它。

platform :ios, '8.0'
use_frameworks!

target 'project_name' do
    pod 'GDPerformanceView', '~> 1.3.1'
end

别忘了通过添加以下代码来导入 GDPerformanceView:

#import <GDPerformanceView/GDPerformanceMonitor.h>

用法示例

简单地开始监控。性能视图将自动添加到状态栏上方。此外,您可以按需配置外观,也可以仅仅隐藏监控视图并使用其代理。

开始监控

[[GDPerformanceMonitor sharedInstance] startMonitoring];
self.performanceMonitor = [GDPerformanceMonitor alloc] init];
[self.performanceMonitor startMonitoring];

调用以开始或恢复监控并显示监控视图。

停止监控

[self.performanceMonitor stopMonitoring];

完成性能监控时调用。

[self.performanceMonitor pauseMonitoring];

隐藏和暂停监控

配置

[self.performanceMonitor configureWithConfiguration:^(UILabel *textLabel) {
    [textLabel setBackgroundColor:[UIColor blackColor]];
    [textLabel setTextColor:[UIColor whiteColor]];
    [textLabel.layer setBorderColor:[[UIColor blackColor] CGColor]];
}];

调用以更改外观。

[self.performanceMonitor setAppVersionHidden:YES]
[self.performanceMonitor setDeviceVersionHidden:YES];

调用以更改输出信息。

[self.performanceMonitor hideMonitoring];

调用以隐藏监控视图。

[self.performanceMonitor configureStatusBarAppearanceWithPrefersStatusBarHidden:NO preferredStatusBarStyle:UIStatusBarStyleLightContent];

调用以更改状态栏外观。

[self.performanceMonitor startMonitoringWithConfiguration:^(UILabel *textLabel) {
    [textLabel setBackgroundColor:[UIColor blackColor]];
    [textLabel setTextColor:[UIColor whiteColor]];
    [textLabel.layer setBorderColor:[[UIColor blackColor] CGColor]];
}];

开始监控并配置

代理

[self.performanceMonitor setDelegate:self];
- (void)performanceMonitorDidReportFPS:(int)fpsValue CPU:(float)cpuValue {
    NSLog(@"%d %f", fpsValue, cpuValue);
}

设置代理并实现其方法。

  • 要求
  • iOS 8.0+

xCode 8.2+

元数据

Daniil Gavrilov - VK - FB