4
這裏是我必須創建一個帶有文本框的UIAlertView的代碼。UIAlertView - 通過代碼添加文本框中的textfield值
UIAlertView *alert = [[UIAlertView alloc] initWithTitle:@"Enter A Username Here" message:@"this gets covered!"
delegate:self cancelButtonTitle:@"Dismiss" otherButtonTitles:@"OK!", nil];
UITextField *myTextField = [[UITextField alloc] initWithFrame:CGRectMake(12, 45, 260, 25)];
CGAffineTransform myTransform = CGAffineTransformMakeTranslation(0, 60);
[alert setTransform:myTransform];
alert.tag = kAlertSaveScore;
[myTextField setBackgroundColor:[UIColor whiteColor]];
[alert addSubview:myTextField];
[alert show];
[alert release];
[myTextField release];
我的問題是,如何從文本字段中獲取的價值:
- (void) alertView:(UIAlertView *) actionSheet clickedButtonAtIndex:(NSInteger)buttonIndex {
}
我知道我能得到標準的東西的alertview如actionSheet.tag等,但如何我會得到上面創建的文本字段嗎?