I have an application that has a UILabel displaying the current date and time, obtained from an instance of NSDate.
I’d like the UILabel to update every second with the current date and time.
How would I update this automatically, rather than just with the initial value obtained during viewDidLoad?
Would I need to have a method that updates this and call it every second using some sort of timer or is there a better way of doing this?
You can create a method, and use the
scheduledTimerWithTimeIntervalto call that method as a selector every second.