小编Inu*_*sha的帖子

如何在Swift中创建一个空数组?

我真的很困惑我们在Swift中创建数组的方式.你能告诉我有多少种方法来创建一个带有一些细节的空数组?

arrays ios swift

136
推荐指数
8
解决办法
21万
查看次数

初始化程序不会从swift中的超类错误覆盖设计的初始化程序

当我打开已经在Xcode 6.3.2上有快速类的项目时,它显示错误.我希望你能帮我解决这个问题.谢谢.

在此输入图像描述

在此输入图像描述

compiler-errors ios swift

2
推荐指数
1
解决办法
6743
查看次数

scheduleLocalNotification在Swift 2.0中不起作用

我是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)

alarm ios uilocalnotification swift swift2

1
推荐指数
1
解决办法
1342
查看次数