开发者

how to distinguish day/night with [NSDate date]?

af开发者_高级运维ter i get current device time by using [NSDate date], how do i know it's daytime or night now?

thanks in advance!


To be absolutely certain, I'd use a weather API like Yahoo's weather. Send the current location to the API, and you'll get back some data that contains the sunset and sunrise times for that area.

If the current time is past the sunset time... blammo.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜