2017-03-22 7 views
1

時間の入力を求めるポップアップが必要です。私はalertviewが行く方法だと思っていましたが、時刻選択ツールをalertviewに埋め込む場所をどこにはわからないのです。UIAlertViewの時間ピッカー

これを行うより良い方法がないかぎりですか?誰のために

+0

あなたは 'AlertController'で' datePicker'を追加することができ、このようにhttpのようにしてみてください:// stackoverflowの。 com/a/40191156/6433023 –

+0

[pickerViewボタンアクションを使用した[swift UIAlertController]の重複の可能性があります(http://stackoverflow.com/questions/40190629/swift-uialertcontroller-with-pickerview-button-action-stay-up) –

答えて

3

、私はそうのような時間ピッカーであることをコメントで質問を適応:

let vc = UIViewController() 
vc.preferredContentSize = CGSize(width: 250,height: 300) 
let pickerView = UIDatePicker(frame: CGRect(x: 0, y: 0, width: 250, height: 300)) 
vc.view.addSubview(pickerView) 
let editRadiusAlert = UIAlertController(title: "Choose ETA", message: "", preferredStyle: UIAlertControllerStyle.alert) 
editRadiusAlert.setValue(vc, forKey: "contentViewController") 
editRadiusAlert.addAction(UIAlertAction(title: "Set ETA", style: .default, handler: nil)) 
editRadiusAlert.addAction(UIAlertAction(title: "Cancel", style: .cancel, handler: nil)) 
self.present(editRadiusAlert, animated: true) 
+0

しかしそのコピーが私の答えthatsなぜupvote –

関連する問題