在 Xcode 4.3 3 中,我创建了一个生成弹出输入框的按钮(按钮 Cancel 和 Enter),工作正常,如何检索输入的数据并将其显示在标签或表格中?
这是我的按钮后面的代码的样子。
- (IBAction)car:(UIButton *) sender
NSString * title1 = [sender titleForState:UIControlStateNormal];
_mylabel.text = title1;
UIAlertView *prompt = [[UIAlertView alloc] initWithTitle:@"Expense Amount in $:"
message:@"\n\n"
delegate:self
cancelButtonTitle:@"Cancel"
otherButtonTitles:@"Enter", nil];
_textField = [[UITextField alloc] initWithFrame:CGRectMake(12, 50, 260, 25)];
[_textField setBackgroundColor:[UIColor whiteColor]];
[_textField setPlaceholder:@"Amount"];
[prompt addSubview:_textField];
_textField.keyboardType = UIKeyboardTypeNumberPad;
// show the dialog box
[prompt show];
// set cursor and show keyboard
[_textField becomeFirstResponder];
}
谢谢您的帮助。