Graphics Programs Reference
In-Depth Information
In TimeViewController.m , implement the action method:
- (IBAction)showCurrentTime:(id)sender
{
NSDate *now = [NSDate date];
NSDateFormatter *formatter = [[NSDateFormatter alloc] init];
[formatter setTimeStyle:NSDateFormatterMediumStyle];
[timeLabel setText:[formatter stringFromDate:now]];
}
Build and run the application. Tap the What time is it? button, and you will see the current
time on the UILabel . Figure 7.12 is the object diagram for the application as it currently
stands.
Figure 7.12 TimeViewController's view on the window
 
Search WWH ::




Custom Search