【发布时间】:2016-04-02 22:33:45
【问题描述】:
我想实现一个修改密码的功能。它要求用户在警告对话框中输入他们以前的密码。
我想点击“确认修改”按钮然后跳转到另一个视图控制器来更改密码。我已经写了一些代码,但我不知道下一刻该怎么写。
UIAlertController *alertController = [UIAlertController alertControllerWithTitle:@"Change password" message:@"Please input your previous password" preferredStyle:UIAlertControllerStyleAlert];
[alertController addTextFieldWithConfigurationHandler:^(UITextField *textField) {
textField.placeholder = @"please input your previous password";
textField.secureTextEntry = YES;
}];
UIAlertAction *cancelAction = [UIAlertAction actionWithTitle:@"cancel" style:UIAlertActionStyleCancel handlers:nil];
UIAlertAction *okAction = [UIAlertAction actionWithTitle:@"Confirm the modification" style:UIAlertActionStyleDestructive handler:*(UIAlertAction *alertAction) {
if (condition) {
statements
}
}];
[alertController addAction:cancelAction];
[alertController addAction:okAction];
[self presentViewController:alertController animated:YES completion:nil];
【问题讨论】:
标签: ios objective-c uitextfield uialertcontroller