iOS开发中显示实时的FPS值
OttoFPSButton
前言
在项目开发中,有的时候需要查看实时的FPS值,以此作为性能的参考。
优势
- 实时显示FPS值。
- 可以拖到任意位置贴边,不影响调试。
效果图


使用
将OttoFPSButton目录拖到目标工程下,在AppDelegate.m里面加入下面代码
#import "OttoFPSButton.h"
- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions {
self.window = [[UIWindow alloc] initWithFrame:[UIScreen mainScreen].bounds];
[self.window makeKeyAndVisible];
CGRect frame = CGRectMake(0, 300, 80, 30);
UIColor *btnBGColor = [UIColor colorWithWhite:0.000 alpha:0.700];
OttoFPSButton *btn = [OttoFPSButton setTouchWithFrame:frame titleColor:[UIColor whiteColor] titleFont:[UIFont systemFontOfSize:15] backgroundColor:btnBGColor backgroundImage:nil];
[self.window addSubview:btn];
return YES;
}这样就能在项目中看到FPS的状态变化了。
相关推荐
好好学习天天 2020-07-21
heqiang0 2020-06-25
定格 2020-05-30
定格 2020-04-17
zhoutaifeng 2020-04-17
zhoutaifeng 2020-04-17
zhoutaifeng 2020-03-07
好好学习天天 2020-03-06
heqiang0 2020-03-02
知更鸟CoolLee 2020-02-27
发条戏子 2020-02-22
herogood 2020-02-19
好好学习天天 2020-02-17
heqiang0 2020-02-13
heqiang0 2019-12-12