如何将UIAlertViewController中的更新数据保存到服务器?

时间:2016-01-14 13:01:03

标签: ios uitextfield uialertcontroller

我的UIAlertViewController中有3个UITextFields的问题,即用户编辑该数据存储到服务器的内容。我怎样才能做到这一点? 这是我的代码

@Controller
@RequestMapping("/about")
public class AboutController {

    @RequestMapping("/")
    public String home(Model model) {
        model.addAttribute("controllerName", "about");
        model.addAttribute("actionName", "home");        
        return "about/home";        
    }

}

当我按下提交按钮时,用户输入的文本将与旧数据匹配并使用新数据进行更新。 这是我的webservice方法,

-(IBAction)changePswd:(id)sender
{
UIAlertController *alert =[UIAlertController alertControllerWithTitle:@"Enter Your Password" message:@"Here !" preferredStyle:UIAlertControllerStyleAlert];
__block typeof(self) weakSelf = self;
[alert addTextFieldWithConfigurationHandler:^(UITextField *textField)
 {
     textField.tag = 100;
     textField.delegate = weakSelf;
     textField.placeholder = @"Old Password";
     textField.secureTextEntry = YES;
 }];
[alert addTextFieldWithConfigurationHandler:^(UITextField *textField)
 {
     textField.tag = 101;
     textField.delegate = weakSelf;
     textField.placeholder = @"New Password";
     textField.secureTextEntry = YES;
 }];
[alert addTextFieldWithConfigurationHandler:^(UITextField *textField)
 {
     textField.tag = 102;
     textField.delegate = weakSelf;
     textField.placeholder = @"Conform Password";
     textField.secureTextEntry = YES;
 }];
UIAlertAction *submitAction = [UIAlertAction actionWithTitle:@"Submit" style:UIAlertActionStyleCancel handler:^(UIAlertAction * _Nonnull action)
                               {
                                   MBProgressHUD *HUD = [[MBProgressHUD alloc] initWithView:self.view];
                                   HUD.labelText =@"Updating Please Wait...";
                                   [self.view addSubview:HUD];
                                   [HUD show:YES];
                                   [HUD showWhileExecuting:@selector(submitDetails) onTarget:self withObject:nil animated:YES];

                               }];
UIAlertAction *cancelAction = [UIAlertAction actionWithTitle:@"Cancel" style:UIAlertActionStyleDefault handler:^(UIAlertAction * _Nonnull action)
{

}];
[alert addAction:cancelAction];
[alert addAction:submitAction];
 [self presentViewController:alert animated:YES completion:nil];
}

0 个答案:

没有答案