我真的很困惑我们在Swift中创建数组的方式.你能告诉我有多少种方法来创建一个带有一些细节的空数组?
当我打开已经在Xcode 6.3.2上有快速类的项目时,它显示错误.我希望你能帮我解决这个问题.谢谢.
我是iOS技术的新手.我正在尝试使用UILocalNotification使用swift 2.0构建一个警报应用程序.当我点击按钮时,我从UIPickerView获取时间和日期.我也想显示通知和播放声音.但声音和通知都不起作用.请帮我!
@IBOutlet weak var myPickerView: UIDatePicker!
override func viewDidLoad() {
super.viewDidLoad()
myPickerView.date = NSDate()
}
override func didReceiveMemoryWarning() {
super.didReceiveMemoryWarning()
// Dispose of any resources that can be recreated.
}
@IBAction func setAlarmClicked(sender: UIButton) {
let dateFormater : NSDateFormatter = NSDateFormatter()
dateFormater.timeZone = NSTimeZone.defaultTimeZone()
dateFormater.timeStyle = .ShortStyle
dateFormater.dateStyle = .ShortStyle
let dateTimeString : NSString = dateFormater.stringFromDate(myPickerView.date)
print("date is \(dateTimeString)")
self.sheduleLocalNotificationWithDate(myPickerView.date)
}
@IBAction func cancelAlarmClicked(sender: UIButton) {
}
func sheduleLocalNotificationWithDate(fireDate : NSDate){
let localNotification : UILocalNotification = UILocalNotification()
localNotification.fireDate = …
Run Code Online (Sandbox Code Playgroud)