diff --git a/OptionSelector.xcodeproj/project.pbxproj b/OptionSelector.xcodeproj/project.pbxproj index 1788504..c75e0cf 100644 --- a/OptionSelector.xcodeproj/project.pbxproj +++ b/OptionSelector.xcodeproj/project.pbxproj @@ -9,11 +9,16 @@ /* Begin PBXBuildFile section */ 8DECE7921B78082B0064D760 /* main.m in Sources */ = {isa = PBXBuildFile; fileRef = 8DECE7911B78082B0064D760 /* main.m */; }; 8DECE7951B78082B0064D760 /* AppDelegate.m in Sources */ = {isa = PBXBuildFile; fileRef = 8DECE7941B78082B0064D760 /* AppDelegate.m */; }; - 8DECE7981B78082B0064D760 /* ViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = 8DECE7971B78082B0064D760 /* ViewController.m */; }; - 8DECE79B1B78082B0064D760 /* Main.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 8DECE7991B78082B0064D760 /* Main.storyboard */; }; - 8DECE79D1B78082B0064D760 /* Images.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = 8DECE79C1B78082B0064D760 /* Images.xcassets */; }; 8DECE7A01B78082B0064D760 /* LaunchScreen.xib in Resources */ = {isa = PBXBuildFile; fileRef = 8DECE79E1B78082B0064D760 /* LaunchScreen.xib */; }; 8DECE7AC1B78082B0064D760 /* OptionSelectorTests.m in Sources */ = {isa = PBXBuildFile; fileRef = 8DECE7AB1B78082B0064D760 /* OptionSelectorTests.m */; }; + F72F82EF1B8273E100715C10 /* Images.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = F72F82EE1B8273E100715C10 /* Images.xcassets */; }; + F72F82F11B82A77F00715C10 /* pastryland.mp3 in Resources */ = {isa = PBXBuildFile; fileRef = F72F82F01B82A77F00715C10 /* pastryland.mp3 */; }; + F72F82F21B82A77F00715C10 /* pastryland.mp3 in Resources */ = {isa = PBXBuildFile; fileRef = F72F82F01B82A77F00715C10 /* pastryland.mp3 */; }; + F7D4F5D81B7D0EEE00BC6BA4 /* PastriesTableViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = F7D4F5D71B7D0EEE00BC6BA4 /* PastriesTableViewController.m */; }; + F7D4F5DB1B7D190600BC6BA4 /* PastryCategories.m in Sources */ = {isa = PBXBuildFile; fileRef = F7D4F5DA1B7D190600BC6BA4 /* PastryCategories.m */; }; + F7D4F6161B7E8AF300BC6BA4 /* POTableViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = F7D4F6151B7E8AF300BC6BA4 /* POTableViewController.m */; }; + F7D4F6191B7E8F0200BC6BA4 /* Main.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = F7D4F6171B7E8F0200BC6BA4 /* Main.storyboard */; }; + F7D4F64D1B824B4800BC6BA4 /* AVFoundation.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = F7D4F64C1B824B4800BC6BA4 /* AVFoundation.framework */; }; /* End PBXBuildFile section */ /* Begin PBXContainerItemProxy section */ @@ -32,14 +37,20 @@ 8DECE7911B78082B0064D760 /* main.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = main.m; sourceTree = ""; }; 8DECE7931B78082B0064D760 /* AppDelegate.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = AppDelegate.h; sourceTree = ""; }; 8DECE7941B78082B0064D760 /* AppDelegate.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = AppDelegate.m; sourceTree = ""; }; - 8DECE7961B78082B0064D760 /* ViewController.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = ViewController.h; sourceTree = ""; }; - 8DECE7971B78082B0064D760 /* ViewController.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = ViewController.m; sourceTree = ""; }; - 8DECE79A1B78082B0064D760 /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; name = Base; path = Base.lproj/Main.storyboard; sourceTree = ""; }; - 8DECE79C1B78082B0064D760 /* Images.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; path = Images.xcassets; sourceTree = ""; }; 8DECE79F1B78082B0064D760 /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.xib; name = Base; path = Base.lproj/LaunchScreen.xib; sourceTree = ""; }; 8DECE7A51B78082B0064D760 /* OptionSelectorTests.xctest */ = {isa = PBXFileReference; explicitFileType = wrapper.cfbundle; includeInIndex = 0; path = OptionSelectorTests.xctest; sourceTree = BUILT_PRODUCTS_DIR; }; 8DECE7AA1B78082B0064D760 /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = ""; }; 8DECE7AB1B78082B0064D760 /* OptionSelectorTests.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = OptionSelectorTests.m; sourceTree = ""; }; + F72F82EE1B8273E100715C10 /* Images.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; path = Images.xcassets; sourceTree = ""; }; + F72F82F01B82A77F00715C10 /* pastryland.mp3 */ = {isa = PBXFileReference; lastKnownFileType = audio.mp3; path = pastryland.mp3; sourceTree = ""; }; + F7D4F5D61B7D0EEE00BC6BA4 /* PastriesTableViewController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = PastriesTableViewController.h; sourceTree = ""; }; + F7D4F5D71B7D0EEE00BC6BA4 /* PastriesTableViewController.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = PastriesTableViewController.m; sourceTree = ""; }; + F7D4F5D91B7D190600BC6BA4 /* PastryCategories.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = PastryCategories.h; sourceTree = ""; }; + F7D4F5DA1B7D190600BC6BA4 /* PastryCategories.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = PastryCategories.m; sourceTree = ""; }; + F7D4F6141B7E8AF300BC6BA4 /* POTableViewController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = POTableViewController.h; sourceTree = ""; }; + F7D4F6151B7E8AF300BC6BA4 /* POTableViewController.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = POTableViewController.m; sourceTree = ""; }; + F7D4F6181B7E8F0200BC6BA4 /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; name = Base; path = Base.lproj/Main.storyboard; sourceTree = ""; }; + F7D4F64C1B824B4800BC6BA4 /* AVFoundation.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = AVFoundation.framework; path = System/Library/Frameworks/AVFoundation.framework; sourceTree = SDKROOT; }; /* End PBXFileReference section */ /* Begin PBXFrameworksBuildPhase section */ @@ -47,6 +58,7 @@ isa = PBXFrameworksBuildPhase; buildActionMask = 2147483647; files = ( + F7D4F64D1B824B4800BC6BA4 /* AVFoundation.framework in Frameworks */, ); runOnlyForDeploymentPostprocessing = 0; }; @@ -63,6 +75,7 @@ 8DECE7831B78082B0064D760 = { isa = PBXGroup; children = ( + F7D4F64C1B824B4800BC6BA4 /* AVFoundation.framework */, 8DECE78E1B78082B0064D760 /* OptionSelector */, 8DECE7A81B78082B0064D760 /* OptionSelectorTests */, 8DECE78D1B78082B0064D760 /* Products */, @@ -83,10 +96,14 @@ children = ( 8DECE7931B78082B0064D760 /* AppDelegate.h */, 8DECE7941B78082B0064D760 /* AppDelegate.m */, - 8DECE7961B78082B0064D760 /* ViewController.h */, - 8DECE7971B78082B0064D760 /* ViewController.m */, - 8DECE7991B78082B0064D760 /* Main.storyboard */, - 8DECE79C1B78082B0064D760 /* Images.xcassets */, + F7D4F5D91B7D190600BC6BA4 /* PastryCategories.h */, + F7D4F5DA1B7D190600BC6BA4 /* PastryCategories.m */, + F7D4F5D61B7D0EEE00BC6BA4 /* PastriesTableViewController.h */, + F7D4F5D71B7D0EEE00BC6BA4 /* PastriesTableViewController.m */, + F7D4F6141B7E8AF300BC6BA4 /* POTableViewController.h */, + F7D4F6151B7E8AF300BC6BA4 /* POTableViewController.m */, + F7D4F6171B7E8F0200BC6BA4 /* Main.storyboard */, + F72F82EE1B8273E100715C10 /* Images.xcassets */, 8DECE79E1B78082B0064D760 /* LaunchScreen.xib */, 8DECE78F1B78082B0064D760 /* Supporting Files */, ); @@ -96,6 +113,7 @@ 8DECE78F1B78082B0064D760 /* Supporting Files */ = { isa = PBXGroup; children = ( + F72F82F01B82A77F00715C10 /* pastryland.mp3 */, 8DECE7901B78082B0064D760 /* Info.plist */, 8DECE7911B78082B0064D760 /* main.m */, ); @@ -199,9 +217,10 @@ isa = PBXResourcesBuildPhase; buildActionMask = 2147483647; files = ( - 8DECE79B1B78082B0064D760 /* Main.storyboard in Resources */, + F7D4F6191B7E8F0200BC6BA4 /* Main.storyboard in Resources */, + F72F82EF1B8273E100715C10 /* Images.xcassets in Resources */, + F72F82F11B82A77F00715C10 /* pastryland.mp3 in Resources */, 8DECE7A01B78082B0064D760 /* LaunchScreen.xib in Resources */, - 8DECE79D1B78082B0064D760 /* Images.xcassets in Resources */, ); runOnlyForDeploymentPostprocessing = 0; }; @@ -209,6 +228,7 @@ isa = PBXResourcesBuildPhase; buildActionMask = 2147483647; files = ( + F72F82F21B82A77F00715C10 /* pastryland.mp3 in Resources */, ); runOnlyForDeploymentPostprocessing = 0; }; @@ -219,9 +239,11 @@ isa = PBXSourcesBuildPhase; buildActionMask = 2147483647; files = ( - 8DECE7981B78082B0064D760 /* ViewController.m in Sources */, 8DECE7951B78082B0064D760 /* AppDelegate.m in Sources */, + F7D4F5D81B7D0EEE00BC6BA4 /* PastriesTableViewController.m in Sources */, + F7D4F5DB1B7D190600BC6BA4 /* PastryCategories.m in Sources */, 8DECE7921B78082B0064D760 /* main.m in Sources */, + F7D4F6161B7E8AF300BC6BA4 /* POTableViewController.m in Sources */, ); runOnlyForDeploymentPostprocessing = 0; }; @@ -244,20 +266,20 @@ /* End PBXTargetDependency section */ /* Begin PBXVariantGroup section */ - 8DECE7991B78082B0064D760 /* Main.storyboard */ = { + 8DECE79E1B78082B0064D760 /* LaunchScreen.xib */ = { isa = PBXVariantGroup; children = ( - 8DECE79A1B78082B0064D760 /* Base */, + 8DECE79F1B78082B0064D760 /* Base */, ); - name = Main.storyboard; + name = LaunchScreen.xib; sourceTree = ""; }; - 8DECE79E1B78082B0064D760 /* LaunchScreen.xib */ = { + F7D4F6171B7E8F0200BC6BA4 /* Main.storyboard */ = { isa = PBXVariantGroup; children = ( - 8DECE79F1B78082B0064D760 /* Base */, + F7D4F6181B7E8F0200BC6BA4 /* Base */, ); - name = LaunchScreen.xib; + name = Main.storyboard; sourceTree = ""; }; /* End PBXVariantGroup section */ @@ -348,7 +370,7 @@ buildSettings = { ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; INFOPLIST_FILE = OptionSelector/Info.plist; - IPHONEOS_DEPLOYMENT_TARGET = 8.0; + IPHONEOS_DEPLOYMENT_TARGET = 6.0; LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks"; PRODUCT_NAME = "$(TARGET_NAME)"; }; @@ -359,7 +381,7 @@ buildSettings = { ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; INFOPLIST_FILE = OptionSelector/Info.plist; - IPHONEOS_DEPLOYMENT_TARGET = 8.0; + IPHONEOS_DEPLOYMENT_TARGET = 6.0; LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks"; PRODUCT_NAME = "$(TARGET_NAME)"; }; @@ -418,6 +440,7 @@ 8DECE7B11B78082B0064D760 /* Release */, ); defaultConfigurationIsVisible = 0; + defaultConfigurationName = Release; }; 8DECE7B21B78082B0064D760 /* Build configuration list for PBXNativeTarget "OptionSelectorTests" */ = { isa = XCConfigurationList; @@ -426,6 +449,7 @@ 8DECE7B41B78082B0064D760 /* Release */, ); defaultConfigurationIsVisible = 0; + defaultConfigurationName = Release; }; /* End XCConfigurationList section */ }; diff --git a/OptionSelector/AppDelegate.h b/OptionSelector/AppDelegate.h index 43405a8..6580e5c 100644 --- a/OptionSelector/AppDelegate.h +++ b/OptionSelector/AppDelegate.h @@ -7,8 +7,13 @@ // #import +#import -@interface AppDelegate : UIResponder + +@interface AppDelegate :UIResponder { + + AVAudioPlayer *pastryMusic; +} @property (strong, nonatomic) UIWindow *window; diff --git a/OptionSelector/AppDelegate.m b/OptionSelector/AppDelegate.m index f9e0e58..4577b9e 100644 --- a/OptionSelector/AppDelegate.m +++ b/OptionSelector/AppDelegate.m @@ -16,7 +16,13 @@ @implementation AppDelegate - (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions { - // Override point for customization after application launch. + + NSString *music = [[NSBundle mainBundle]pathForResource:@"pastryland" ofType:@"mp3"]; + pastryMusic = [[AVAudioPlayer alloc] initWithContentsOfURL: [NSURL fileURLWithPath:music] error:NULL]; + pastryMusic.delegate = self; + pastryMusic.numberOfLoops = -1; + [pastryMusic play]; + return YES; } diff --git a/OptionSelector/Base.lproj/LaunchScreen.xib b/OptionSelector/Base.lproj/LaunchScreen.xib index 5df6182..c837c0c 100644 --- a/OptionSelector/Base.lproj/LaunchScreen.xib +++ b/OptionSelector/Base.lproj/LaunchScreen.xib @@ -1,7 +1,8 @@ - + - + + diff --git a/OptionSelector/Base.lproj/Main.storyboard b/OptionSelector/Base.lproj/Main.storyboard index d912f9d..0d179dd 100644 --- a/OptionSelector/Base.lproj/Main.storyboard +++ b/OptionSelector/Base.lproj/Main.storyboard @@ -1,25 +1,117 @@ - + - + + - - + + - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - - - - - + + + + + + + + + + + + + + + + + + + + + + + diff --git a/OptionSelector/Images.xcassets/Cupcakes.imageset/Contents.json b/OptionSelector/Images.xcassets/Cupcakes.imageset/Contents.json new file mode 100644 index 0000000..8fd0523 --- /dev/null +++ b/OptionSelector/Images.xcassets/Cupcakes.imageset/Contents.json @@ -0,0 +1,21 @@ +{ + "images" : [ + { + "idiom" : "universal", + "scale" : "1x" + }, + { + "idiom" : "universal", + "scale" : "2x" + }, + { + "idiom" : "universal", + "scale" : "3x", + "filename" : "Cupcakes.png" + } + ], + "info" : { + "version" : 1, + "author" : "xcode" + } +} \ No newline at end of file diff --git a/OptionSelector/Images.xcassets/Cupcakes.imageset/Cupcakes.png b/OptionSelector/Images.xcassets/Cupcakes.imageset/Cupcakes.png new file mode 100644 index 0000000..3aa60a4 Binary files /dev/null and b/OptionSelector/Images.xcassets/Cupcakes.imageset/Cupcakes.png differ diff --git a/OptionSelector/Images.xcassets/Doughnuts.imageset/Contents.json b/OptionSelector/Images.xcassets/Doughnuts.imageset/Contents.json new file mode 100644 index 0000000..9543d6d --- /dev/null +++ b/OptionSelector/Images.xcassets/Doughnuts.imageset/Contents.json @@ -0,0 +1,21 @@ +{ + "images" : [ + { + "idiom" : "universal", + "scale" : "1x" + }, + { + "idiom" : "universal", + "scale" : "2x" + }, + { + "idiom" : "universal", + "scale" : "3x", + "filename" : "Doughnuts.png" + } + ], + "info" : { + "version" : 1, + "author" : "xcode" + } +} \ No newline at end of file diff --git a/OptionSelector/Images.xcassets/Doughnuts.imageset/Doughnuts.png b/OptionSelector/Images.xcassets/Doughnuts.imageset/Doughnuts.png new file mode 100644 index 0000000..6baba6e Binary files /dev/null and b/OptionSelector/Images.xcassets/Doughnuts.imageset/Doughnuts.png differ diff --git a/OptionSelector/Images.xcassets/Jellybeans.imageset/Contents.json b/OptionSelector/Images.xcassets/Jellybeans.imageset/Contents.json new file mode 100644 index 0000000..31627dd --- /dev/null +++ b/OptionSelector/Images.xcassets/Jellybeans.imageset/Contents.json @@ -0,0 +1,21 @@ +{ + "images" : [ + { + "idiom" : "universal", + "scale" : "1x" + }, + { + "idiom" : "universal", + "scale" : "2x" + }, + { + "idiom" : "universal", + "scale" : "3x", + "filename" : "Jellybeans.png" + } + ], + "info" : { + "version" : 1, + "author" : "xcode" + } +} \ No newline at end of file diff --git a/OptionSelector/Images.xcassets/Jellybeans.imageset/Jellybeans.png b/OptionSelector/Images.xcassets/Jellybeans.imageset/Jellybeans.png new file mode 100644 index 0000000..05de501 Binary files /dev/null and b/OptionSelector/Images.xcassets/Jellybeans.imageset/Jellybeans.png differ diff --git a/OptionSelector/Images.xcassets/Macaroons.imageset/Contents.json b/OptionSelector/Images.xcassets/Macaroons.imageset/Contents.json new file mode 100644 index 0000000..685d2e2 --- /dev/null +++ b/OptionSelector/Images.xcassets/Macaroons.imageset/Contents.json @@ -0,0 +1,21 @@ +{ + "images" : [ + { + "idiom" : "universal", + "scale" : "1x" + }, + { + "idiom" : "universal", + "scale" : "2x" + }, + { + "idiom" : "universal", + "scale" : "3x", + "filename" : "Macaroons.png" + } + ], + "info" : { + "version" : 1, + "author" : "xcode" + } +} \ No newline at end of file diff --git a/OptionSelector/Images.xcassets/Macaroons.imageset/Macaroons.png b/OptionSelector/Images.xcassets/Macaroons.imageset/Macaroons.png new file mode 100644 index 0000000..2307bc8 Binary files /dev/null and b/OptionSelector/Images.xcassets/Macaroons.imageset/Macaroons.png differ diff --git a/OptionSelector/POTableViewController.h b/OptionSelector/POTableViewController.h new file mode 100644 index 0000000..816fc03 --- /dev/null +++ b/OptionSelector/POTableViewController.h @@ -0,0 +1,20 @@ +// +// POTableViewController.h +// OptionSelector +// +// Created by Christella on 8/14/15. +// Copyright (c) 2015 Mike Kavouras. All rights reserved. +// + +#import +#import "PastryCategories.h" +#import "PastriesTableViewController.h" + + +@interface POTableViewController : UITableViewController + +@property (nonatomic) PastryCategories *category; +@property (nonatomic,weak) PastriesTableViewController *delegate; + + +@end diff --git a/OptionSelector/POTableViewController.m b/OptionSelector/POTableViewController.m new file mode 100644 index 0000000..224e262 --- /dev/null +++ b/OptionSelector/POTableViewController.m @@ -0,0 +1,78 @@ +// +// POTableViewController.m +// OptionSelector +// +// Created by Christella on 8/14/15. +// Copyright (c) 2015 Mike Kavouras. All rights reserved. +// + +#import "POTableViewController.h" +#import "PastryCategories.h" +#import "PastriesTableViewController.h" + + +@interface POTableViewController () + + +@end + + +@implementation POTableViewController + + +- (void)viewDidLoad { + + [super viewDidLoad]; + +} + +- (void)didReceiveMemoryWarning { + + [super didReceiveMemoryWarning]; + +} + + +#pragma mark - Table view data source + + + +- (NSInteger)numberOfSectionsInTableView:(UITableView *)tableView { + + return 1; +} + + +- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section { + + return self.category.pastryOptions.count; +} + + +- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath { + UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:@"OptionSelected" forIndexPath:indexPath]; + + cell.textLabel.text = [self.category.pastryOptions objectAtIndex:indexPath.row]; + + //checkmark methods + cell.accessoryType = UITableViewCellAccessoryNone; + if ([cell.textLabel.text isEqualToString:self.category.pastrySelection]) { + cell.accessoryType = UITableViewCellAccessoryCheckmark; + } + + return cell; +} + + +- (void) tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath { + + self.category.pastrySelection = [self.category.pastryOptions objectAtIndex:indexPath.row]; + + [self.delegate.tableView reloadData]; + + [self.tableView reloadData]; + + +} + +@end diff --git a/OptionSelector/PastriesTableViewController.h b/OptionSelector/PastriesTableViewController.h new file mode 100644 index 0000000..968c43b --- /dev/null +++ b/OptionSelector/PastriesTableViewController.h @@ -0,0 +1,14 @@ +// +// PastriesTableViewController.h +// OptionSelector +// +// Created by Christella on 8/13/15. +// Copyright (c) 2015 Mike Kavouras. All rights reserved. +// + +#import +#import + +@interface PastriesTableViewController : UITableViewController + +@end diff --git a/OptionSelector/PastriesTableViewController.m b/OptionSelector/PastriesTableViewController.m new file mode 100644 index 0000000..4e02fcc --- /dev/null +++ b/OptionSelector/PastriesTableViewController.m @@ -0,0 +1,140 @@ +// +// PastriesTableViewController.m +// OptionSelector +// +// Created by Christella on 8/13/15. +// Copyright (c) 2015 Mike Kavouras. All rights reserved. +// + +#import "PastriesTableViewController.h" +#import "POTableViewController.h" +#import "PastryCategories.h" +#import + + +@interface PastriesTableViewController () { + + AVAudioPlayer *_pastryLandBackground; +} + + +@property NSArray *storePastryCategories; + + +-(void) setupPastryData; + + +@end + +@implementation PastriesTableViewController + + +- (void)viewDidLoad { + + [super viewDidLoad]; + + [self setupPastryData]; + + self.navigationItem.title = @"🍧🍰 Pastries 🍰🍧"; + self.navigationController.navigationBar.tintColor = [UIColor whiteColor]; + [self.navigationController.navigationBar +setTitleTextAttributes:@{NSForegroundColorAttributeName : [UIColor whiteColor]}]; + + + self.navigationController.navigationBar.barTintColor = [UIColor colorWithRed:0.99 green:0.71 blue:0.83 alpha:1.0]; + +} + + +- (void)viewDidAppear:(BOOL)animated { + + [self.tableView reloadData]; + +} + + +#pragma mark Cells color + +- (void)tableView: (UITableView*)tableView + willDisplayCell: (UITableViewCell*)cell +forRowAtIndexPath: (NSIndexPath*)indexPath +{ + cell.backgroundColor = indexPath.row % 2 + ? [UIColor colorWithRed:0.99 green:0.92 blue:0.97 alpha:1.0] + : [UIColor whiteColor]; +} + + +#pragma mark - The Data + + +-(void) setupPastryData { + + PastryCategories *donuts = [[PastryCategories alloc]init]; + PastryCategories *jellybeans = [[PastryCategories alloc]init]; + PastryCategories *cupcakes = [[PastryCategories alloc]init]; + PastryCategories *macaroons = [[PastryCategories alloc]init]; + + donuts.pastryName = @"Doughnuts"; + donuts.pastryOptions = @[@"Tres Leches Cake",@"Double Chocolate",@"Cream Brulee",@"Coconut Cream",@"Blueberry Cake",@"Strawberry Cake",@"Vanilla Bean",@"Rosemary Pineapple",@"Lavender Flowers",@"Coconut Lime"]; + + jellybeans.pastryName = @"JellyBeans"; + jellybeans.pastryOptions = @[@"Coconut",@"Bubble Gum",@"Root Beer",@"Mango",@"Tutti-Frutti",@"Cotton Candy",@"Vanilla Bean",@"Strawberry Short Cake",@"Lime",@"Lemon"]; + + cupcakes.pastryName = @"Cupcakes"; + cupcakes.pastryOptions = @[@"Boston Cream", @"Sugar Cookie", @"Tie Dye",@"Cookies & Cream",@"Cookie Dough", @"Red Velvet", @"Ice Cream Sundae", @"Root Beer", @"Chocolate Chip Pancake", @"Triple Chocolate Fudge"]; + + macaroons.pastryName = @"Macaroons"; + macaroons.pastryOptions = @[@"Vanilla",@"Cherry", @"Peach", @"Rasberry", @"Rose", @"Banana", @"Kiwi", @"Strawberry", @"Green Tea",@"Caramel"]; + + self.storePastryCategories = @[donuts, jellybeans, cupcakes, macaroons,]; +} + + +#pragma mark - Table view data source + + +- (NSInteger)numberOfSectionsInTableView:(UITableView *)tableView { + + return 1; +} + + +- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section { + + return self.storePastryCategories.count; +} + + +- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath { + + UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:@"PastryCategorySelected" forIndexPath:indexPath]; + + PastryCategories *pastry = [self.storePastryCategories objectAtIndex:indexPath.row]; + + cell.textLabel.text = pastry.pastryName; + cell.imageView.image = [UIImage imageNamed:pastry.pastryName]; + cell.detailTextLabel.text = pastry.pastrySelection; + + return cell; +} + + + +#pragma mark Navigation + + +- (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender +{ + POTableViewController *vc = segue.destinationViewController; + + NSIndexPath *indexPath = [self.tableView indexPathForSelectedRow]; + + PastryCategories *newCategory = [self.storePastryCategories objectAtIndex:indexPath.row]; + + vc.category = newCategory; + vc.delegate = self; + +} + +@end diff --git a/OptionSelector/PastryCategories.h b/OptionSelector/PastryCategories.h new file mode 100644 index 0000000..03bc97e --- /dev/null +++ b/OptionSelector/PastryCategories.h @@ -0,0 +1,17 @@ +// +// PastryCategories.h +// OptionSelector +// +// Created by Christella on 8/13/15. +// Copyright (c) 2015 Mike Kavouras. All rights reserved. +// + +#import + +@interface PastryCategories : NSObject + +@property (nonatomic)NSString *pastryName; +@property (nonatomic)NSArray *pastryOptions; +@property (nonatomic)NSString *pastrySelection; + +@end \ No newline at end of file diff --git a/OptionSelector/PastryCategories.m b/OptionSelector/PastryCategories.m new file mode 100644 index 0000000..2fbf4ec --- /dev/null +++ b/OptionSelector/PastryCategories.m @@ -0,0 +1,14 @@ +// +// PastryCategories.m +// OptionSelector +// +// Created by Christella on 8/13/15. +// Copyright (c) 2015 Mike Kavouras. All rights reserved. +// + +#import "PastryCategories.h" + +@implementation PastryCategories + + +@end diff --git a/OptionSelector/pastryland.mp3 b/OptionSelector/pastryland.mp3 new file mode 100644 index 0000000..e7b7c4f Binary files /dev/null and b/OptionSelector/pastryland.mp3 differ