hi..........
first use this NSTimer as follow:
NSTimer *myTicker = [NSTimer scheduledTimerWithTimeInterval:1 target: self
selector: @selector(showActivity) userInfo: nil
repeats: YES];
then call showActivity method For updating the time with Current time
that look like A digital watch.
ShowActivity funtion is as:
NSDateFormatter *formatter =[[[NSDateFormatter alloc] init] autorelease];
NSDate *date = [NSDate date];
// This will produce a time that looks like "12:15:00 PM".
[formatter setTimeStyle:NSDateFormatterMediumStyle];
// This sets the label with the updated time.
[time setText:[formatter stringFromDate:date]];
first use this NSTimer as follow:
NSTimer *myTicker = [NSTimer scheduledTimerWithTimeInterval:1 target: self
selector: @selector(showActivity) userInfo: nil
repeats: YES];
then call showActivity method For updating the time with Current time
that look like A digital watch.
ShowActivity funtion is as:
NSDateFormatter *formatter =[[[NSDateFormatter alloc] init] autorelease];
NSDate *date = [NSDate date];
// This will produce a time that looks like "12:15:00 PM".
[formatter setTimeStyle:NSDateFormatterMediumStyle];
// This sets the label with the updated time.
[time setText:[formatter stringFromDate:date]];
No comments:
Post a Comment