嗨我正在使用下面的代碼,其中包括alertView包含用戶名和密碼字段。如何訪問secureTextEntry以供進一步使用?
這些用戶ID和口令文本字段,我做密碼字段作爲安全的,但是當我以後要訪問密碼字段中輸入的數據,其顯示密碼字段沒有值..
我的代碼是
self.loginPassword = [[ UIAlertView alloc] initWithTitle:@"Please Login" message:@"Enter Valid UserID and Password\n\n\n\n" delegate:self cancelButtonTitle:@"OK" otherButtonTitles:@"Cancel", nil];
//[self.loginPassword setAlertViewStyle:UIAlertViewStyleLoginAndPasswordInput];
self.userIDText = [[UITextField alloc] initWithFrame:CGRectMake(12.0, 80.0, 260.0, 25.0)];
[email protected]"";
[self.userIDText setBackgroundColor:[UIColor whiteColor]];
[self.userIDText setKeyboardAppearance:UIKeyboardAppearanceAlert];
[self.userIDText setAutocorrectionType:UITextAutocorrectionTypeNo];
[self.userIDText setTextAlignment:UITextAlignmentLeft];
self.passwordField = [[UITextField alloc] initWithFrame:CGRectMake(12.0,115.0, 260.0, 25.0)];
[email protected]"";
[self.passwordField setBackgroundColor:[UIColor whiteColor]];
[self.passwordField setKeyboardAppearance:UIKeyboardAppearanceAlert];
[self.passwordField setAutocorrectionType:UITextAutocorrectionTypeNo];
[self.passwordField setTextAlignment:UITextAlignmentLeft];
[self.loginPassword addSubview:self.userIDText];
[self.loginPassword addSubview:self.passwordField];
self.passwordField.secureTextEntry = YES;
[self.loginPassword setTag:2];
[self.loginPassword show];
[self.loginPassword release];
請建議我一些解決方案..
你爲什麼要創建自己的文本字段,而不是使用'UIAlertViewStyleLoginAndPasswordInput'的風格? – rmaddy 2013-04-22 03:43:15
沒有iOS 4.3不會支持這..我創建子視圖alertView – Raju 2013-04-22 03:45:41