This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//Dinner.h | |
#import <Foundation/Foundation.h> | |
@interface Dinner: NSObject | |
@property (nonatomic, strong) NSString *appetizer; | |
@property (nonatomic, strong) NSString *mainDish; | |
@property (nonatomic, strong) NSString *dessert; | |
@property (nonatomic, strong) NSArray *ingredientsForAppetizer; | |
@property (nonatomic, strong) NSArray *ingredientsForMainDish; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Dinner.m | |
#import "Dinner.h" | |
@implementation Dinner | |
- (void)prepareAppetizer | |
{ | |
//Do something to prepare the appetizer. | |
} | |
- (void)cookMainDish { | |
//Do something to cook the main dish. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Dinner+CleanUp.h | |
#import "Dinner.h" | |
@interface Dinner (CleanUp) | |
- (void)bringDishesToSink; | |
- (NSUInteger)countTotalDishes; | |
- (void)putDishesInDishwasher; | |
- (void)removeDishesFromDishwasher; | |
@end | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//ViewController.m | |
#import "ViewController.h" | |
@interface ViewController () | |
@property (weak, nonatomic) IBOutlet UIButton *NYC; | |
@property (weak, nonatomic) IBOutlet UIButton *paris; | |
@property (weak, nonatomic) IBOutlet UIButton *moscow; | |
@property (weak, nonatomic) IBOutlet UIButton *hongKong; | |
@property (weak, nonatomic) IBOutlet UIButton *honolulu; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@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; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
-(void)setTappedCityTimer { | |
[self.timer invalidate]; | |
self.timer = nil; | |
[self setDateTimeLabelsWithTimeZone]; | |
self.timer = [NSTimer scheduledTimerWithTimeInterval:1.0 target:self selector:@selector(setDateTimeLabelsWithTimeZone) userInfo:nil repeats:YES]; | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
-(NSArray *)formatCurrentDateTimeForTimeZone { //Gets current date each time it's fired. | |
NSDateFormatter *dateFormatter = [[NSDateFormatter alloc] init]; | |
NSDateFormatter *timeFormatter = [[NSDateFormatter alloc] init]; | |
NSLocale *posix = [[NSLocale alloc] initWithLocaleIdentifier:@"en_US_POSIX"]; | |
NSTimeZone *localTimeZone = [NSTimeZone timeZoneWithAbbreviation:self.timeZone]; | |
[dateFormatter setLocale:posix]; | |
[dateFormatter setDateFormat:@"EEEE MMMM dd y"]; | |
[dateFormatter setTimeZone:localTimeZone]; | |
[timeFormatter setLocale:posix]; | |
[timeFormatter setDateFormat:@"h:mm:ss a"]; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@interface ViewController () | |
@property (nonatomic, weak) IBOutlet UIButton *nyc; | |
@property (nonatomic, weak) IBOutlet UIButton *paris; | |
@property (nonatomic, weak) IBOutlet UIButton *moscow; | |
@property (nonatomic, weak) IBOutlet UIButton *hongKong; | |
@property (nonatomic, weak) IBOutlet UIButton *honolulu; | |
@property (nonatomic, weak) IBOutlet UIButton *seattle; | |
@property (nonatomic, weak) IBOutlet UILabel *timeLabel; | |
@property (nonatomic, weak) IBOutlet UILabel *dateLabel; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
-(void)unhighlightDeselected { | |
NSArray *cities = [@[self.nyc, self.paris, self.moscow, self.hongKong, self.honolulu, self.seattle]mutableCopy]; | |
NSMutableArray *unselectedCities = [NSMutableArray array]; | |
for (UIButton *city in cities) { | |
if (city != self.selectedButton) { | |
[unselectedCities addObject:city]; | |
} | |
} | |
[unselectedCities setValue:[UIColor blueColor] forKey:@"tintColor"]; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#import "ViewController.h" | |
@interface ViewController () | |
@property (nonatomic, weak) IBOutlet UIButton *nyc; | |
@property (nonatomic, weak) IBOutlet UIButton *paris; | |
@property (nonatomic, weak) IBOutlet UIButton *moscow; | |
@property (nonatomic, weak) IBOutlet UIButton *hongKong; | |
@property (nonatomic, weak) IBOutlet UIButton *honolulu; | |
@property (nonatomic, weak) IBOutlet UIButton *seattle; |
OlderNewer