I've made a clock, and 开发者_如何学CI'm trying to update it so it displays, well, the time. When I initiate the NSDate it is an instance of the exact current time, for the time it was initiated. So what I have going on here is pinging the updateTime function with an NSTimer to update the clock every 3 seconds.
It seems that there should be a way to do this better? I'm afraid I'm using more resources then necessary by doing this method, and while performance isn't really an issue for a clock, I'd like to get better at my resource management.
Don't be afraid of NSTimer
. A timer that fires once a second (or even less in your case) hardly uses any resources. It's the way to do this.
精彩评论