Skip to content

Instantly share code, notes, and snippets.

@jen2
Last active May 7, 2017 20:13
Show Gist options
  • Save jen2/11d3edeccc1c9b29588fdaeda751b125 to your computer and use it in GitHub Desktop.
Save jen2/11d3edeccc1c9b29588fdaeda751b125 to your computer and use it in GitHub Desktop.
Setting up implementation for cityButtonTapped: method in "Build a World Clock in Objective-C."
@implementation ViewController
- (void)viewDidLoad {
[super viewDidLoad];
}
- (IBAction)cityButtonTapped:(UIButton *)sender { //Gets which button is tapped
switch (sender.tag) {
case 100:
self.timeZone = @"EST";
self.selectedButton = self.nyc;
break;
case 101:
self.timeZone = @"CEST";
self.selectedButton = self.paris;
break;
case 102:
self.timeZone = @"MSD";
self.selectedButton = self.moscow;
break;
case 103:
self.timeZone = @"HKT";
self.selectedButton = self.hongKong;
break;
case 104:
self.timeZone = @"HST";
self.selectedButton = self.honolulu;
break;
case 105:
self.timeZone = @"PST";
self.selectedButton = self.seattle;
break;
default:
self.timeZone = @"EST";
self.selectedButton = self.nyc;
break;
}
[self setTappedCityTimer];
}
@end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment