提交 d7d2d154 编写于 作者: H Hugin

CPU FPS Memory NetFlow 4个检测控件横屏适配

上级 dc5b6a9f
......@@ -37,7 +37,7 @@
- (instancetype)initWithFrame:(CGRect)frame{
self = [super initWithFrame:frame];
if (self) {
_kStartX = kDoraemonSizeFrom750(52);
_kStartX = kDoraemonSizeFrom750_Landscape(52);
self.backgroundColor = [UIColor clearColor];
self.showsVerticalScrollIndicator = NO;
......@@ -50,18 +50,18 @@
_pointList = [NSMutableArray array];
_pointLayerList = [NSMutableArray array];
_bottomLine = [[UIView alloc] initWithFrame:CGRectMake(_kStartX, self.doraemon_height-kDoraemonSizeFrom750(1), self.doraemon_width, kDoraemonSizeFrom750(1))];
_bottomLine = [[UIView alloc] initWithFrame:CGRectMake(_kStartX, self.doraemon_height-kDoraemonSizeFrom750_Landscape(1), self.doraemon_width, kDoraemonSizeFrom750_Landscape(1))];
_bottomLine.backgroundColor = [UIColor doraemon_colorWithString:@"#999999"];
[self addSubview:_bottomLine];
_lowValueLabel = [[UILabel alloc] initWithFrame:CGRectMake(0, self.doraemon_height-kDoraemonSizeFrom750(28)/2, _kStartX, kDoraemonSizeFrom750(28))];
_lowValueLabel = [[UILabel alloc] initWithFrame:CGRectMake(0, self.doraemon_height-kDoraemonSizeFrom750_Landscape(28)/2, _kStartX, kDoraemonSizeFrom750_Landscape(28))];
_lowValueLabel.text = @"0";
_lowValueLabel.textColor = [UIColor whiteColor];
_lowValueLabel.textAlignment = NSTextAlignmentCenter;
_lowValueLabel.font = [UIFont systemFontOfSize:10];
[self addSubview:_lowValueLabel];
_highValueLabel = [[UILabel alloc] initWithFrame:CGRectMake(0, -kDoraemonSizeFrom750(28)/2, _kStartX, kDoraemonSizeFrom750(28))];
_highValueLabel = [[UILabel alloc] initWithFrame:CGRectMake(0, -kDoraemonSizeFrom750_Landscape(28)/2, _kStartX, kDoraemonSizeFrom750_Landscape(28))];
_highValueLabel.text = @"100";
_highValueLabel.textColor = [UIColor whiteColor];
_highValueLabel.textAlignment = NSTextAlignmentCenter;
......@@ -71,7 +71,7 @@
_tipLabel = [[UILabel alloc] init];
_tipLabel.textColor = [UIColor doraemon_colorWithString:@"#00DFDD"];
_tipLabel.textAlignment = NSTextAlignmentCenter;
_tipLabel.font = [UIFont systemFontOfSize:kDoraemonSizeFrom750(20)];
_tipLabel.font = [UIFont systemFontOfSize:kDoraemonSizeFrom750_Landscape(20)];
_tipLabel.lineBreakMode = NSLineBreakByClipping;
[self addSubview:_tipLabel];
}
......@@ -170,7 +170,7 @@
CALayer *pointLayer = [CALayer layer];
pointLayer.backgroundColor = [UIColor doraemon_colorWithString:@"#00DFDD"].CGColor;
pointLayer.cornerRadius = 2;
pointLayer.frame = CGRectMake(point.x-kDoraemonSizeFrom750(8)/2, point.y-kDoraemonSizeFrom750(8)/2, kDoraemonSizeFrom750(8), kDoraemonSizeFrom750(8));
pointLayer.frame = CGRectMake(point.x-kDoraemonSizeFrom750_Landscape(8)/2, point.y-kDoraemonSizeFrom750_Landscape(8)/2, kDoraemonSizeFrom750_Landscape(8), kDoraemonSizeFrom750_Landscape(8));
[_pointLayerList addObject:pointLayer];
}
......
......@@ -13,7 +13,10 @@
@end
@implementation DoraemonOscillogramViewController
- (void)viewWillTransitionToSize:(CGSize)size withTransitionCoordinator:(id<UIViewControllerTransitionCoordinator>)coordinator {
[super viewWillTransitionToSize:size withTransitionCoordinator:coordinator];
dispatch_async(dispatch_get_main_queue(), ^{
self.view.window.frame = CGRectMake(0, 0, size.height, size.width);
});
}
@end
......@@ -30,6 +30,7 @@
if (self) {
self.windowLevel = UIWindowLevelStatusBar + 1.f;
self.backgroundColor = [UIColor doraemon_colorWithHex:0x000000 andAlpha:0.33];
self.layer.masksToBounds = YES;
[self addRootVc];
}
......@@ -54,7 +55,11 @@
- (void)show{
self.hidden = NO;
self.frame = CGRectMake(0, 0, DoraemonScreenWidth, kDoraemonSizeFrom750(480)+IPHONE_TOPSENSOR_HEIGHT);
if (kInterfaceOrientationPortrait) {
self.frame = CGRectMake(0, 0, DoraemonScreenWidth, kDoraemonSizeFrom750(480)+IPHONE_TOPSENSOR_HEIGHT);
} else {
self.frame = CGRectMake(0, 0, DoraemonScreenHeight, kDoraemonSizeFrom750_Landscape(480)+IPHONE_TOPSENSOR_HEIGHT);
}
[_vc startRecord];
}
......
......@@ -32,19 +32,19 @@
UILabel *titleLabel = [[UILabel alloc] init];
titleLabel.backgroundColor = [UIColor clearColor];
titleLabel.text = DoraemonLocalizedString(@"CPU检测");
titleLabel.font = [UIFont systemFontOfSize:kDoraemonSizeFrom750(20)];
titleLabel.font = [UIFont systemFontOfSize:kDoraemonSizeFrom750_Landscape(20)];
titleLabel.textColor = [UIColor whiteColor];
[self.view addSubview:titleLabel];
[titleLabel sizeToFit];
titleLabel.frame = CGRectMake(kDoraemonSizeFrom750(20), IPHONE_TOPSENSOR_HEIGHT + kDoraemonSizeFrom750(10), titleLabel.doraemon_width, titleLabel.doraemon_height);
titleLabel.frame = CGRectMake(kDoraemonSizeFrom750_Landscape(20), IPHONE_TOPSENSOR_HEIGHT + kDoraemonSizeFrom750_Landscape(10), titleLabel.doraemon_width, titleLabel.doraemon_height);
UIButton *closeBtn = [[UIButton alloc] init];
[closeBtn setImage:[UIImage doraemon_imageNamed:@"doraemon_close_white"] forState:UIControlStateNormal];
closeBtn.frame = CGRectMake(self.view.doraemon_width-kDoraemonSizeFrom750(60), IPHONE_TOPSENSOR_HEIGHT, kDoraemonSizeFrom750(60), kDoraemonSizeFrom750(60));
closeBtn.frame = CGRectMake((kInterfaceOrientationPortrait ? DoraemonScreenWidth : DoraemonScreenHeight)-kDoraemonSizeFrom750_Landscape(60), IPHONE_TOPSENSOR_HEIGHT, kDoraemonSizeFrom750_Landscape(60), kDoraemonSizeFrom750_Landscape(60));
[closeBtn addTarget:self action:@selector(closeBtnClick) forControlEvents:UIControlEventTouchUpInside];
[self.view addSubview:closeBtn];
_oscillogramView = [[DoraemonOscillogramView alloc] initWithFrame:CGRectMake(0, titleLabel.doraemon_bottom+kDoraemonSizeFrom750(24), self.view.doraemon_width, kDoraemonSizeFrom750(400))];
_oscillogramView = [[DoraemonOscillogramView alloc] initWithFrame:CGRectMake(0, titleLabel.doraemon_bottom+kDoraemonSizeFrom750_Landscape(24), (kInterfaceOrientationPortrait ? DoraemonScreenWidth : DoraemonScreenHeight), kDoraemonSizeFrom750_Landscape(400))];
_oscillogramView.backgroundColor = [UIColor clearColor];
[_oscillogramView setLowValue:@"0"];
[_oscillogramView setHightValue:@"100"];
......
......@@ -32,19 +32,20 @@
UILabel *titleLabel = [[UILabel alloc] init];
titleLabel.backgroundColor = [UIColor clearColor];
titleLabel.text = DoraemonLocalizedString(@"帧率检测");
titleLabel.font = [UIFont systemFontOfSize:kDoraemonSizeFrom750(20)];
titleLabel.font = [UIFont systemFontOfSize:kDoraemonSizeFrom750_Landscape(20)];
titleLabel.textColor = [UIColor whiteColor];
[self.view addSubview:titleLabel];
[titleLabel sizeToFit];
titleLabel.frame = CGRectMake(kDoraemonSizeFrom750(20), IPHONE_TOPSENSOR_HEIGHT + kDoraemonSizeFrom750(10), titleLabel.doraemon_width, titleLabel.doraemon_height);
titleLabel.frame = CGRectMake(kDoraemonSizeFrom750_Landscape(20), IPHONE_TOPSENSOR_HEIGHT + kDoraemonSizeFrom750_Landscape(10), titleLabel.doraemon_width, titleLabel.doraemon_height);
UIButton *closeBtn = [[UIButton alloc] init];
[closeBtn setImage:[UIImage doraemon_imageNamed:@"doraemon_close_white"] forState:UIControlStateNormal];
closeBtn.frame = CGRectMake(self.view.doraemon_width-kDoraemonSizeFrom750(60), IPHONE_TOPSENSOR_HEIGHT, kDoraemonSizeFrom750(60), kDoraemonSizeFrom750(60));
closeBtn.frame = CGRectMake((kInterfaceOrientationPortrait ? DoraemonScreenWidth : DoraemonScreenHeight)-kDoraemonSizeFrom750_Landscape(60), IPHONE_TOPSENSOR_HEIGHT, kDoraemonSizeFrom750_Landscape(60), kDoraemonSizeFrom750_Landscape(60));
[closeBtn addTarget:self action:@selector(closeBtnClick) forControlEvents:UIControlEventTouchUpInside];
[self.view addSubview:closeBtn];
_oscillogramView = [[DoraemonOscillogramView alloc] initWithFrame:CGRectMake(0, titleLabel.doraemon_bottom+kDoraemonSizeFrom750(24), self.view.doraemon_width, kDoraemonSizeFrom750(400))];
_oscillogramView = [[DoraemonOscillogramView alloc] initWithFrame:CGRectMake(0, titleLabel.doraemon_bottom+kDoraemonSizeFrom750_Landscape(24), (kInterfaceOrientationPortrait ? DoraemonScreenWidth : DoraemonScreenHeight), kDoraemonSizeFrom750_Landscape(400))];
_oscillogramView.backgroundColor = [UIColor clearColor];
[_oscillogramView setLowValue:@"0"];
[_oscillogramView setHightValue:@"60"];
......
......@@ -32,19 +32,19 @@
UILabel *titleLabel = [[UILabel alloc] init];
titleLabel.backgroundColor = [UIColor clearColor];
titleLabel.text = DoraemonLocalizedString(@"内存检测");
titleLabel.font = [UIFont systemFontOfSize:kDoraemonSizeFrom750(20)];
titleLabel.font = [UIFont systemFontOfSize:kDoraemonSizeFrom750_Landscape(20)];
titleLabel.textColor = [UIColor whiteColor];
[self.view addSubview:titleLabel];
[titleLabel sizeToFit];
titleLabel.frame = CGRectMake(kDoraemonSizeFrom750(20), IPHONE_TOPSENSOR_HEIGHT + kDoraemonSizeFrom750(10), titleLabel.doraemon_width, titleLabel.doraemon_height);
titleLabel.frame = CGRectMake(kDoraemonSizeFrom750_Landscape(20), IPHONE_TOPSENSOR_HEIGHT + kDoraemonSizeFrom750_Landscape(10), titleLabel.doraemon_width, titleLabel.doraemon_height);
UIButton *closeBtn = [[UIButton alloc] init];
[closeBtn setImage:[UIImage doraemon_imageNamed:@"doraemon_close_white"] forState:UIControlStateNormal];
closeBtn.frame = CGRectMake(self.view.doraemon_width-kDoraemonSizeFrom750(60), IPHONE_TOPSENSOR_HEIGHT, kDoraemonSizeFrom750(60), kDoraemonSizeFrom750(60));
closeBtn.frame = CGRectMake((kInterfaceOrientationPortrait ? DoraemonScreenWidth : DoraemonScreenHeight)-kDoraemonSizeFrom750_Landscape(60), IPHONE_TOPSENSOR_HEIGHT, kDoraemonSizeFrom750_Landscape(60), kDoraemonSizeFrom750_Landscape(60));
[closeBtn addTarget:self action:@selector(closeBtnClick) forControlEvents:UIControlEventTouchUpInside];
[self.view addSubview:closeBtn];
_oscillogramView = [[DoraemonOscillogramView alloc] initWithFrame:CGRectMake(0, titleLabel.doraemon_bottom+kDoraemonSizeFrom750(24), self.view.doraemon_width, kDoraemonSizeFrom750(400))];
_oscillogramView = [[DoraemonOscillogramView alloc] initWithFrame:CGRectMake(0, titleLabel.doraemon_bottom+kDoraemonSizeFrom750_Landscape(24), (kInterfaceOrientationPortrait ? DoraemonScreenWidth : DoraemonScreenHeight), kDoraemonSizeFrom750_Landscape(400))];
_oscillogramView.backgroundColor = [UIColor clearColor];
[_oscillogramView setLowValue:@"0"];
[_oscillogramView setHightValue:[NSString stringWithFormat:@"%zi",[self deviceMemory]]];
......
......@@ -31,19 +31,19 @@
UILabel *titleLabel = [[UILabel alloc] init];
titleLabel.backgroundColor = [UIColor clearColor];
titleLabel.text = DoraemonLocalizedString(@"流量检测");
titleLabel.font = [UIFont systemFontOfSize:kDoraemonSizeFrom750(20)];
titleLabel.font = [UIFont systemFontOfSize:kDoraemonSizeFrom750_Landscape(20)];
titleLabel.textColor = [UIColor whiteColor];
[self.view addSubview:titleLabel];
[titleLabel sizeToFit];
titleLabel.frame = CGRectMake(kDoraemonSizeFrom750(20), IPHONE_TOPSENSOR_HEIGHT + kDoraemonSizeFrom750(10), titleLabel.doraemon_width, titleLabel.doraemon_height);
titleLabel.frame = CGRectMake(kDoraemonSizeFrom750_Landscape(20), IPHONE_TOPSENSOR_HEIGHT + kDoraemonSizeFrom750_Landscape(10), titleLabel.doraemon_width, titleLabel.doraemon_height);
UIButton *closeBtn = [[UIButton alloc] init];
[closeBtn setImage:[UIImage doraemon_imageNamed:@"doraemon_close_white"] forState:UIControlStateNormal];
closeBtn.frame = CGRectMake(self.view.doraemon_width-kDoraemonSizeFrom750(60), IPHONE_TOPSENSOR_HEIGHT, kDoraemonSizeFrom750(60), kDoraemonSizeFrom750(60));
closeBtn.frame = CGRectMake((kInterfaceOrientationPortrait ? DoraemonScreenWidth : DoraemonScreenHeight)-kDoraemonSizeFrom750_Landscape(60), IPHONE_TOPSENSOR_HEIGHT, kDoraemonSizeFrom750_Landscape(60), kDoraemonSizeFrom750_Landscape(60));
[closeBtn addTarget:self action:@selector(closeBtnClick) forControlEvents:UIControlEventTouchUpInside];
[self.view addSubview:closeBtn];
_oscillogramView = [[DoraemonOscillogramView alloc] initWithFrame:CGRectMake(0, titleLabel.doraemon_bottom+kDoraemonSizeFrom750(24), self.view.doraemon_width, kDoraemonSizeFrom750(400))];
_oscillogramView = [[DoraemonOscillogramView alloc] initWithFrame:CGRectMake(0, titleLabel.doraemon_bottom+kDoraemonSizeFrom750_Landscape(24), (kInterfaceOrientationPortrait ? DoraemonScreenWidth : DoraemonScreenHeight), kDoraemonSizeFrom750_Landscape(400))];
_oscillogramView.backgroundColor = [UIColor clearColor];
[_oscillogramView setLowValue:@"0"];
[_oscillogramView setHightValue:[NSString stringWithFormat:@"%zi",[self highestNetFlow]]];
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册