1010#import " Coding_NetAPIManager.h"
1111
1212#import < SDCAlertController.h>
13+ #import < SDCAlertView.h>
14+ #import < UIView+SDCAutoLayout.h>
1315#import " ProjectDeleteAlertControllerVisualStyle.h"
1416
1517@interface ProjectAdvancedSettingViewController ()
@@ -21,6 +23,7 @@ @implementation ProjectAdvancedSettingViewController
2123- (void )viewDidLoad {
2224 [super viewDidLoad ];
2325
26+ self.title = @" 高级设置" ;
2427 self.tableView .tableFooterView = [UIView new ];
2528}
2629
@@ -60,24 +63,38 @@ -(void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *
6063
6164 SDCAlertController *alert = [SDCAlertController alertControllerWithTitle: title message: message preferredStyle: SDCAlertControllerStyleAlert];
6265
66+ UITextField *passwordTextField = [[UITextField alloc ] initWithFrame: CGRectMake (15 , 0 , 240.0 , 30.0 )];
67+ passwordTextField.leftView = [[UIView alloc ] initWithFrame: CGRectMake (0 , 0 , 5 , 30 )];
68+ passwordTextField.leftViewMode = UITextFieldViewModeAlways;
69+ passwordTextField.layer .borderColor = [[UIColor lightGrayColor ] colorWithAlphaComponent: 0.6 ].CGColor ;
70+ passwordTextField.layer .borderWidth = 1 ;
71+ passwordTextField.secureTextEntry = YES ;
72+ passwordTextField.backgroundColor = [UIColor whiteColor ];
73+
74+ [alert.contentView addSubview: passwordTextField];
75+
76+ NSDictionary * passwordViews = NSDictionaryOfVariableBindings(passwordTextField);
77+
78+ [alert.contentView addConstraints: [NSLayoutConstraint constraintsWithVisualFormat: @" V:|-[passwordTextField]-(>=14)-|" options: 0 metrics: nil views: passwordViews]];
79+
80+ [passwordTextField becomeFirstResponder ];
81+
6382 // Style
6483 alert.visualStyle = [ProjectDeleteAlertControllerVisualStyle new ];
6584
6685 // 添加密码框
67- [alert addTextFieldWithConfigurationHandler: ^(UITextField *textField) {
68- textField.secureTextEntry = YES ;
69- }];
86+ // [alert addTextFieldWithConfigurationHandler:^(UITextField *textField) {
87+ // textField.secureTextEntry = YES;
88+ // }];
7089
7190 // 添加按钮
7291 alert.actionLayout = SDCAlertControllerActionLayoutHorizontal;
73- [alert addAction: [SDCAlertAction actionWithTitle: @" 取消" style: SDCAlertActionStyleCancel handler: ^(SDCAlertAction *action) {
74- [alert dismissWithCompletion: nil ];
75- }]];
92+ [alert addAction: [SDCAlertAction actionWithTitle: @" 取消" style: SDCAlertActionStyleDefault handler: nil ]];
7693 [alert addAction: [SDCAlertAction actionWithTitle: @" 确定" style: SDCAlertActionStyleDefault handler: ^(SDCAlertAction *action) {
77- UITextField *passwordTextField = [[alert textFields ] firstObject ];
94+
7895 NSString *password = [passwordTextField.text stringByTrimmingCharactersInSet: [NSCharacterSet whitespaceCharacterSet ]];
7996
80- if (password > 0 ) {
97+ if ([ password length ] > 0 ) {
8198 // 删除项目
8299 [[Coding_NetAPIManager sharedManager ] request_DeleteProject_WithObj: self .project password: password andBlock: ^(Project *data, NSError *error) {
83100 if (!error) {
@@ -87,7 +104,7 @@ -(void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *
87104 }];
88105 }
89106 }]];
90-
107+
91108 [alert presentWithCompletion: nil ];
92109}
93110
0 commit comments