diff --git a/iOS/DoraemonKit/Src/Core/CommonUI/Oscillogram/DoraemonOscillogramView.m b/iOS/DoraemonKit/Src/Core/CommonUI/Oscillogram/DoraemonOscillogramView.m index 0cbbf28a4d33af9d001a44c95f6c37398c9a1da4..6367c5ee026da0317cf17049495416dc1dc5f8da 100644 --- a/iOS/DoraemonKit/Src/Core/CommonUI/Oscillogram/DoraemonOscillogramView.m +++ b/iOS/DoraemonKit/Src/Core/CommonUI/Oscillogram/DoraemonOscillogramView.m @@ -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]; } diff --git a/iOS/DoraemonKit/Src/Core/CommonUI/Oscillogram/DoraemonOscillogramViewController.m b/iOS/DoraemonKit/Src/Core/CommonUI/Oscillogram/DoraemonOscillogramViewController.m index b84eb4d9068295a66b3c9336b0497f97ac432135..c2ec2cfa5dd237a76e6e7f288c754dac64597c8d 100644 --- a/iOS/DoraemonKit/Src/Core/CommonUI/Oscillogram/DoraemonOscillogramViewController.m +++ b/iOS/DoraemonKit/Src/Core/CommonUI/Oscillogram/DoraemonOscillogramViewController.m @@ -13,7 +13,10 @@ @end @implementation DoraemonOscillogramViewController - - - +- (void)viewWillTransitionToSize:(CGSize)size withTransitionCoordinator:(id)coordinator { + [super viewWillTransitionToSize:size withTransitionCoordinator:coordinator]; + dispatch_async(dispatch_get_main_queue(), ^{ + self.view.window.frame = CGRectMake(0, 0, size.height, size.width); + }); +} @end diff --git a/iOS/DoraemonKit/Src/Core/CommonUI/Oscillogram/DoraemonOscillogramWindow.m b/iOS/DoraemonKit/Src/Core/CommonUI/Oscillogram/DoraemonOscillogramWindow.m index 9d873c8700ead34dcd1324ea141bc9fff45a6635..73c986e5f51139b5ed39250c57631866d7ecf178 100644 --- a/iOS/DoraemonKit/Src/Core/CommonUI/Oscillogram/DoraemonOscillogramWindow.m +++ b/iOS/DoraemonKit/Src/Core/CommonUI/Oscillogram/DoraemonOscillogramWindow.m @@ -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]; } diff --git a/iOS/DoraemonKit/Src/Core/Plugin/CPU/Function/DoraemonCPUOscillogramViewController.m b/iOS/DoraemonKit/Src/Core/Plugin/CPU/Function/DoraemonCPUOscillogramViewController.m index 9e6703bbdff2ac17fc2956b65629b78534ae6f78..b7c1dcc11d867fc9d3c6e7e3033392019ca81548 100644 --- a/iOS/DoraemonKit/Src/Core/Plugin/CPU/Function/DoraemonCPUOscillogramViewController.m +++ b/iOS/DoraemonKit/Src/Core/Plugin/CPU/Function/DoraemonCPUOscillogramViewController.m @@ -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"]; diff --git a/iOS/DoraemonKit/Src/Core/Plugin/FPS/Function/DoraemonFPSOscillogramViewController.m b/iOS/DoraemonKit/Src/Core/Plugin/FPS/Function/DoraemonFPSOscillogramViewController.m index 07ad8fed94b5da6694743c3fd0dce6bcabe8afb4..f36f652f6048ed6b1fc47b51a6e5bc9962703e49 100644 --- a/iOS/DoraemonKit/Src/Core/Plugin/FPS/Function/DoraemonFPSOscillogramViewController.m +++ b/iOS/DoraemonKit/Src/Core/Plugin/FPS/Function/DoraemonFPSOscillogramViewController.m @@ -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"]; diff --git a/iOS/DoraemonKit/Src/Core/Plugin/Memory/Function/DoraemonMemoryOscillogramViewController.m b/iOS/DoraemonKit/Src/Core/Plugin/Memory/Function/DoraemonMemoryOscillogramViewController.m index 531a0f3a00afe5b1ddb72a41002edd3f084b1e2a..d9843fcd3dde5f3869750dfc564e75c3ef8be276 100644 --- a/iOS/DoraemonKit/Src/Core/Plugin/Memory/Function/DoraemonMemoryOscillogramViewController.m +++ b/iOS/DoraemonKit/Src/Core/Plugin/Memory/Function/DoraemonMemoryOscillogramViewController.m @@ -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]]]; diff --git a/iOS/DoraemonKit/Src/Core/Plugin/NetFlow/Function/View/DoraemonNetFlowOscillogramViewController.m b/iOS/DoraemonKit/Src/Core/Plugin/NetFlow/Function/View/DoraemonNetFlowOscillogramViewController.m index 7360b2aca5bd03e15095f0ddc00c53a9113d85f5..04f14db7d51f739e7f6f57dff354d7eb083ffc55 100644 --- a/iOS/DoraemonKit/Src/Core/Plugin/NetFlow/Function/View/DoraemonNetFlowOscillogramViewController.m +++ b/iOS/DoraemonKit/Src/Core/Plugin/NetFlow/Function/View/DoraemonNetFlowOscillogramViewController.m @@ -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]]];