Import the files SPClockView.h and SPClockView.m into your projects.
After adding the SPClockView into your parent view, set its time zone by calling setTimeZone: method.
Digital clock SPDigitalClock is a subclass of UILabel, and is implemented inside the SPClockView class. To set the digital time also call the method setTimeZone: on SPDigitalClock
示例:
SPClockView
SPClockView *clockView = [[SPClockView alloc] initWithFrame:CGRectMake(0, 0, 140, 140)]; [clockView setTimeZone:[NSTimeZone timeZoneWithAbbreviation:@"EDT"]]; // New York
SPDigitalClock
SPDigitalClock *digClock = [[SPDigitalClock alloc] initWithFrame:CGRectMake(0, 0, 140, 140)]; [digClock setTimeZone:[NSTimeZone timeZoneWithAbbreviation:@"EDT"]]; // New York