UIAlertView自带password输入框

来源:互联网 发布:mac 桌面壁纸位置 编辑:程序博客网 时间:2024/06/13 02:40

 UIAlertView *alertView = [[UIAlertViewalloc]initWithTitle:@"Password"

                                                      message:@"Please enter your password"

                                                     delegate:self

                                            cancelButtonTitle:@"Cancel"

                                            otherButtonTitles:@"OK",nil];

    [alertView setAlertViewStyle:UIAlertViewStyleSecureTextInput];

    [alertViewshow];


AlertViewStyle:

typedefNS_ENUM(NSInteger, UIAlertViewStyle) {

    UIAlertViewStyleDefault =0,

    UIAlertViewStyleSecureTextInput,

    UIAlertViewStylePlainTextInput,

    UIAlertViewStyleLoginAndPasswordInput

};


UIAlertViewDelegate:


-(void)alertView:(UIAlertView *)alertView clickedButtonAtIndex:(NSInteger)buttonIndex{

   UITextField *tf = [alertView textFieldAtIndex:0];

   NSLog(@"%@",tf.text);

}


总之棒棒的

0 0