我已經得到了從試圖找到一個答案,這也太沮喪,所以我會爲一個問題...從UIAlertView中文本框中輸入提取的Objective-C
如何從一個UIAlertView中獲得的原始文本Objective-C中的文本框?
這裏是我的代碼:
UIButton *AppCrashButton = [UIButton buttonWithType: UIButtonTypeCustom];
AppCrashButton.frame = CGRectMake(0, (self.view.frame.size.height - 44)/6 * 1, self.view.frame.size.width, (self.view.frame.size.height - 44)/6);
[AppCrashButton setTitle: @"Ping" forState: UIControlStateNormal];
[AppCrashButton addTarget: self action: @selector(Click) forControlEvents: UIControlEventTouchUpInside];
AppCrashButton.backgroundColor = [UIColor colorWithRed:0.19 green:0.19 blue:0.19 alpha:1.0];
AppCrashButton.layer.borderColor = [UIColor colorWithRed:0.96 green:0.26 blue:0.21 alpha:1.0].CGColor;
AppCrashButton.layer.borderWidth = 0.5f;
[self.view addSubview: AppCrashButton];
-(void) Click {
UIAlertView *AppCrashAlert = [[UIAlertView alloc] initWithTitle: @"IP Ping" message: @"Please enter the IP address" delegate: self cancelButtonTitle: @"Cancel" otherButtonTitles: @"OK", nil];
AppCrashAlert.alertViewStyle = UIAlertViewStylePlainTextInput;
[AppCrashAlert show];
[AppCrashAlert release];
}
它顯示了一個自定義按鈕,一旦點擊,執行「點擊」的方法,其中執行ping主機。
我想知道如何從文本輸入中獲取文本。
感謝
僅供參考 - 'UIAlertView'被棄用早在iOS版8.您應該使用'UIAlertController'。 – rmaddy