我正在做一个应用程序,它将使我的日期选择器成为当前时间,然后它将创建一个警报。我到目前为止创建了下面的代码。但是在移动了datepicker之后,我立即给了我一个警告:
let dateFormatter = NSDateFormatter()
dateFormatter.dateFormat = "h:mm a"
let strDate = dateFormatter.stringFromDate(setTime.date)
self.Time.text = strDate
AudioServicesPlayAlertSound(1036)
let alertView = UIAlertController(title: "This is an Alert!", message: "", preferredStyle: UIAlertControllerStyle.Alert)
alertView.addAction(UIAlertAction(title: "OK", style: UIAlertActionStyle.Default, handler: nil))
self.presentViewController(alertView, animated: true, completion:nil)