1,实现一个alertView
1 UIAlertView *alertView = [[UIAlertView alloc]initWithTitle:@"" message:@"请输入Wi-Fi密码" delegate:self cancelButtonTitle:@"取消" otherButtonTitles:@"确定", nil]; 2 alertView.alertViewStyle = UIAlertViewStyleSecureTextInput; 3 [alertView show];
2,实现代理方法
1 #pragma mark - UIAlertViewDelegate 2 - (void)alertView:(UIAlertView *)alertView clickedButtonAtIndex:(NSInteger)buttonIndex{ 3 UITextField *passwordText = [alertView textFieldAtIndex:0]; 4 // passwordText. 5 NSLog(@"%@",passwordText.text); 6 NSLog(@"buttonIndex:%d",buttonIndex); 7 }
时间: 2024-10-10 07:01:00