cdts/xdts-ios 3/TreeHole/Code/Features/Settings/ViewController/SystemSettingsViewController.m
2023-07-27 09:20:00 +08:00

96 lines
3.3 KiB
Objective-C

//
// SystemSettingsViewController.m
// Youth
//
// Created by 谢培艺 on 2022/1/14.
//
#import "SystemSettingsViewController.h"
@interface SystemSettingsViewController ()
@end
@implementation SystemSettingsViewController
- (BOOL)isSupportContentScrollView {
return YES;
}
- (void)viewDidLoad {
[super viewDidLoad];
self.title = @"系统权限管理";
NSArray *icons = @[
@"TH_system_phone_icon",
@"TH_system_camera_icon",
@"TH_system_store_icon",
@"TH_system_mic_icon",
];
NSArray *titles = @[@"电话", @"相机", @"存储", @"麦克风"];
NSArray *infos = @[@"读取设备的状态和移动网络信息,设备信息",
@"拍摄后发送图文或视频,使用扫一扫等功能",
@"发送手机上的照片,设置头像,内容信息",
@"发送语音消息,进行音视频通话"];
self.contentScrollView.backgroundColor = BG_COLOR;
for (int i = 0; i < titles.count; i++) {
UIView *item = [self createItemWithTitle:titles[i] info:infos[i] iconName:icons[i]];
item.y = NAVIGATION_BAR_HEIGHT + NORMAL_SPACE + item.height * i;
[self.contentScrollView addSubview:item];
}
UILabel *jumpToSystemSettingsLabel = [UILabel mt_titleLabelWithText:@"前往系统设置"];
jumpToSystemSettingsLabel.font = SMALL_FONT;
jumpToSystemSettingsLabel.textColor = THEME_COLOR;
[jumpToSystemSettingsLabel sizeToFit];
jumpToSystemSettingsLabel.width += 30;
jumpToSystemSettingsLabel.height += 20;
jumpToSystemSettingsLabel.bottom = SCREEN_HEIGHT - FIX_SIZE(44);
jumpToSystemSettingsLabel.centerX = SCREEN_WIDTH * 0.5;
[jumpToSystemSettingsLabel addTapWithAction:^{
[PYAppService jumpToSystemAppSettingsPage];
}];
jumpToSystemSettingsLabel.textAlignment = NSTextAlignmentCenter;
[self.contentScrollView addSubview:jumpToSystemSettingsLabel];
}
- (UIView *)createItemWithTitle:(NSString *)title info:(NSString *)info iconName:(NSString *)iconName {
UIView *item = [[UIView alloc] init];
item.width = SCREEN_WIDTH;
item.height = FIX_SIZE(70);
item.backgroundColor = COLOR_WITH_RGB(0x222436);
UIImageView *iconView = [[UIImageView alloc] init];
iconView.size = CGSizeMake(FIX_SIZE(30), FIX_SIZE(30));
iconView.x = NORMAL_SPACE;
iconView.image = ImageNamed(iconName);
iconView.centerY = item.height * 0.5;
[item addSubview:iconView];
UILabel *titleLabel = [UILabel mt_titleLabelWithText:title];
titleLabel.textColor = [UIColor whiteColor];
titleLabel.font = SMALL_MEDIUM_FONT;
titleLabel.x = iconView.right + NORMAL_SPACE;
[titleLabel sizeToFit];
titleLabel.bottom = iconView.centerY - FIX_SIZE(3);
[item addSubview:titleLabel];
UILabel *infoLabel = [UILabel mt_titleLabelWithText:info];
infoLabel.textColor = COLOR_WITH_RGB(0x737373);
infoLabel.font = FONT_SIZE(11);
[infoLabel sizeToFit];
infoLabel.y = iconView.centerY + FIX_SIZE(3);
infoLabel.x = titleLabel.x;
[item addSubview:infoLabel];
UIView *line = [UIView lineViewWithWidth:SCREEN_WIDTH];
line.backgroundColor = [UIColor colorWithWhite:1.0 alpha:0.1];
line.height = 0.5;
line.x = titleLabel.x;
line.bottom = item.height;
[item addSubview:line];
return item;
}
@end