在iOS 11的Apple时钟应用程序中设置iPhone的计时器

问题描述 投票:0回答:1

是否有API将Apple的Clock应用程序中的计时器设置为特定的倒计时?

我知道有Reminders SDK和EventKit,但我一直在寻找设置计时器而不是提醒。

Timer in the Clock app

ios ios11
1个回答
1
投票

不,没有可用的API。您应该在应用程序内创建自定义计时器以复制该功能。

使用Timer类的Foundation在您的应用程序中创建一个简单的计时器。

let timer: Timer!

timer = Timer.scheduledTimer(withTimeInterval: 60, repeats: false) { timer in
    [completion code]
}

有关使用倒计时创建计时器的更多信息,请查看this question

© www.soinside.com 2019 - 2024. All rights reserved.