Xcode 4.3 3에서 (Cancel & Enter를 입력하여) 팝업 입력 상자를 생성하는 버튼을 만들었습니다. 입력 한 데이터를 검색하여 레이블 또는 표?UIAlertView에서 입력 텍스트를 가져옵니다
내 단추 뒤의 코드는 다음과 같습니다.
- (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];
}
감사합니다.
안녕하세요 jaydee3, 답장을 보내 주셔서 감사합니다.이 모든 것을 처음 접했고 구현 방법에 대해 저에게 도움이 될 수 있습니까? 다시 Thx. – Diffrey
구현을 위해이 자습서를 참조하십시오. http://mobile.tutsplus.com/tutorials/iphone/ios-5-sdk-uialertview-text-input-and-validation/ – calimarkus