1
This commit is contained in:
@@ -12,65 +12,78 @@
|
||||
@property (nonatomic, strong) UILabel *tipsLabel; // 步骤提示
|
||||
@property (nonatomic, strong) UIView *cardView; // 中部卡片
|
||||
@property (nonatomic, strong) UIButton *openButton; // 去设置
|
||||
@property (nonatomic, strong) UIButton *closeButton; // 去设置
|
||||
|
||||
@property (nonatomic, strong) UILabel *helpLabel; // 底部帮助
|
||||
@property (nonatomic, strong) UIImageView *redImageView;
|
||||
|
||||
@property (nonatomic, strong) UIImageView *bgImageView;
|
||||
|
||||
@end
|
||||
|
||||
@implementation KBPermissionViewController
|
||||
|
||||
- (void)viewDidLoad {
|
||||
[super viewDidLoad];
|
||||
self.view.backgroundColor = [UIColor colorWithWhite:0.96 alpha:1.0];
|
||||
[self.view addSubview:self.bgImageView];
|
||||
[self.view addSubview:self.redImageView];
|
||||
|
||||
// 懒加载控件 + 添加到视图
|
||||
[self.view addSubview:self.backButton];
|
||||
[self.view addSubview:self.closeButton];
|
||||
[self.view addSubview:self.titleLabel];
|
||||
[self.view addSubview:self.tipsLabel];
|
||||
[self.view addSubview:self.cardView];
|
||||
[self.view addSubview:self.openButton];
|
||||
[self.view addSubview:self.helpLabel];
|
||||
|
||||
// Masonry 约束
|
||||
[self.backButton mas_makeConstraints:^(MASConstraintMaker *make) {
|
||||
make.left.equalTo(self.view).offset(16);
|
||||
make.top.equalTo(self.view.mas_safeAreaLayoutGuideTop).offset(8);
|
||||
|
||||
make.width.mas_equalTo(60);
|
||||
make.height.mas_equalTo(32);
|
||||
|
||||
[self.bgImageView mas_makeConstraints:^(MASConstraintMaker *make) {
|
||||
make.edges.equalTo(self.view);
|
||||
}];
|
||||
// Masonry 约束
|
||||
[self.closeButton mas_makeConstraints:^(MASConstraintMaker *make) {
|
||||
make.left.equalTo(self.view).offset(16);
|
||||
make.top.equalTo(self.view.mas_safeAreaLayoutGuideTop).offset(20);
|
||||
make.width.mas_equalTo(26);
|
||||
make.height.mas_equalTo(26);
|
||||
}];
|
||||
[self.redImageView mas_makeConstraints:^(MASConstraintMaker *make) {
|
||||
make.top.equalTo(self.closeButton.mas_centerY);
|
||||
make.right.equalTo(self.view).offset(20);
|
||||
make.width.mas_equalTo(143);
|
||||
make.height.mas_equalTo(132);
|
||||
}];
|
||||
|
||||
|
||||
[self.titleLabel mas_makeConstraints:^(MASConstraintMaker *make) {
|
||||
make.top.equalTo(self.view.mas_safeAreaLayoutGuideTop).offset(48);
|
||||
|
||||
make.left.equalTo(self.view).offset(24);
|
||||
make.right.equalTo(self.view).offset(-24);
|
||||
make.height.mas_equalTo(28);
|
||||
make.top.equalTo(self.closeButton.mas_bottom).offset(13);
|
||||
make.left.equalTo(self.view).offset(22);
|
||||
make.height.mas_equalTo(24);
|
||||
}];
|
||||
|
||||
[self.tipsLabel mas_makeConstraints:^(MASConstraintMaker *make) {
|
||||
make.top.equalTo(self.titleLabel.mas_bottom).offset(8);
|
||||
make.left.equalTo(self.view).offset(24);
|
||||
make.right.equalTo(self.view).offset(-24);
|
||||
make.left.equalTo(self.titleLabel);
|
||||
}];
|
||||
|
||||
[self.cardView mas_makeConstraints:^(MASConstraintMaker *make) {
|
||||
make.top.equalTo(self.tipsLabel.mas_bottom).offset(28);
|
||||
make.left.equalTo(self.view).offset(32);
|
||||
make.right.equalTo(self.view).offset(-32);
|
||||
make.height.mas_equalTo(260);
|
||||
make.bottom.equalTo(self.openButton.mas_top).offset(-36);
|
||||
make.left.right.equalTo(self.view).inset(56);
|
||||
make.top.equalTo(self.tipsLabel.mas_bottom).offset(36);
|
||||
}];
|
||||
|
||||
[self.openButton mas_makeConstraints:^(MASConstraintMaker *make) {
|
||||
make.top.equalTo(self.cardView.mas_bottom).offset(32);
|
||||
make.left.equalTo(self.view).offset(32);
|
||||
make.right.equalTo(self.view).offset(-32);
|
||||
make.height.mas_equalTo(48);
|
||||
make.bottom.equalTo(self.view).offset(-KB_SAFE_BOTTOM-20);
|
||||
make.left.equalTo(self.view).offset(47);
|
||||
make.right.equalTo(self.view).offset(-47);
|
||||
make.height.mas_equalTo(60);
|
||||
}];
|
||||
|
||||
[self.helpLabel mas_makeConstraints:^(MASConstraintMaker *make) {
|
||||
make.top.equalTo(self.openButton.mas_bottom).offset(12);
|
||||
make.left.equalTo(self.view).offset(24);
|
||||
make.right.equalTo(self.view).offset(-24);
|
||||
}];
|
||||
// [self.helpLabel mas_makeConstraints:^(MASConstraintMaker *make) {
|
||||
// make.top.equalTo(self.openButton.mas_bottom).offset(12);
|
||||
// make.left.equalTo(self.view).offset(24);
|
||||
// make.right.equalTo(self.view).offset(-24);
|
||||
// }];
|
||||
}
|
||||
|
||||
#pragma mark - Actions
|
||||
@@ -112,6 +125,10 @@
|
||||
}
|
||||
}
|
||||
|
||||
- (void)closeButtonAction{
|
||||
[self.navigationController popViewControllerAnimated:true];
|
||||
}
|
||||
|
||||
#pragma mark - Lazy Subviews
|
||||
|
||||
- (UIButton *)backButton {
|
||||
@@ -128,8 +145,8 @@
|
||||
- (UILabel *)titleLabel {
|
||||
if (!_titleLabel) {
|
||||
_titleLabel = [UILabel new];
|
||||
_titleLabel.text = KBLocalized(@"perm_title_enable");
|
||||
_titleLabel.font = [UIFont systemFontOfSize:22 weight:UIFontWeightSemibold];
|
||||
_titleLabel.text = (@"key of love keyboard");
|
||||
_titleLabel.font = [UIFont systemFontOfSize:20 weight:UIFontWeightSemibold];
|
||||
_titleLabel.textColor = [UIColor blackColor];
|
||||
_titleLabel.textAlignment = NSTextAlignmentCenter;
|
||||
}
|
||||
@@ -139,7 +156,7 @@
|
||||
- (UILabel *)tipsLabel {
|
||||
if (!_tipsLabel) {
|
||||
_tipsLabel = [UILabel new];
|
||||
_tipsLabel.text = KBLocalized(@"perm_steps");
|
||||
_tipsLabel.text = (@"One-click to find a partner");
|
||||
_tipsLabel.font = [UIFont systemFontOfSize:14];
|
||||
_tipsLabel.textColor = [UIColor darkGrayColor];
|
||||
_tipsLabel.textAlignment = NSTextAlignmentCenter;
|
||||
@@ -161,17 +178,26 @@
|
||||
|
||||
- (UIButton *)openButton {
|
||||
if (!_openButton) {
|
||||
_openButton = [UIButton buttonWithType:UIButtonTypeSystem];
|
||||
[_openButton setTitle:KBLocalized(@"perm_open_settings") forState:UIControlStateNormal];
|
||||
_openButton.titleLabel.font = [UIFont systemFontOfSize:17 weight:UIFontWeightSemibold];
|
||||
_openButton = [UIButton buttonWithType:UIButtonTypeCustom];
|
||||
[_openButton setTitle:@"Turn on the keyboard" forState:UIControlStateNormal];
|
||||
_openButton.titleLabel.font = [UIFont systemFontOfSize:16 weight:UIFontWeightSemibold];
|
||||
[_openButton setTitleColor:[UIColor whiteColor] forState:UIControlStateNormal];
|
||||
_openButton.backgroundColor = [UIColor colorWithRed:0.22 green:0.49 blue:0.96 alpha:1.0];
|
||||
_openButton.layer.cornerRadius = 8;
|
||||
_openButton.backgroundColor = [UIColor colorWithHex:KBBlackValue];
|
||||
_openButton.layer.cornerRadius = 30;
|
||||
[_openButton addTarget:self action:@selector(openSettings) forControlEvents:UIControlEventTouchUpInside];
|
||||
}
|
||||
return _openButton;
|
||||
}
|
||||
|
||||
- (UIButton *)closeButton {
|
||||
if (!_closeButton) {
|
||||
_closeButton = [UIButton buttonWithType:UIButtonTypeCustom];
|
||||
[_closeButton setImage:[UIImage imageNamed:@"close_icon"] forState:UIControlStateNormal];
|
||||
[_closeButton addTarget:self action:@selector(closeButtonAction) forControlEvents:UIControlEventTouchUpInside];
|
||||
}
|
||||
return _closeButton;
|
||||
}
|
||||
|
||||
- (UILabel *)helpLabel {
|
||||
if (!_helpLabel) {
|
||||
_helpLabel = [UILabel new];
|
||||
@@ -184,4 +210,20 @@
|
||||
return _helpLabel;
|
||||
}
|
||||
|
||||
|
||||
- (UIImageView *)bgImageView{
|
||||
if (!_bgImageView) {
|
||||
_bgImageView = [[UIImageView alloc] init];
|
||||
_bgImageView.image = [UIImage imageNamed:@"qx_bg_icon"];
|
||||
}
|
||||
return _bgImageView;
|
||||
}
|
||||
- (UIImageView *)redImageView{
|
||||
if (!_redImageView) {
|
||||
_redImageView = [[UIImageView alloc] init];
|
||||
_redImageView.image = [UIImage imageNamed:@"qx_ax_icon"];
|
||||
}
|
||||
return _redImageView;
|
||||
}
|
||||
|
||||
@end
|
||||
|
||||
Reference in New Issue
Block a user