diff --git a/HeadsUpper/HeadsUpper.xcodeproj/project.pbxproj b/HeadsUpper/HeadsUpper.xcodeproj/project.pbxproj index fb900f8..9633adc 100644 --- a/HeadsUpper/HeadsUpper.xcodeproj/project.pbxproj +++ b/HeadsUpper/HeadsUpper.xcodeproj/project.pbxproj @@ -7,25 +7,52 @@ objects = { /* Begin PBXBuildFile section */ + 218377F1C84952A0ACDE493A /* libPods.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 5F0297BB6D8F25F838E77565 /* libPods.a */; }; 8D89695C1C755D0200D32E8A /* main.m in Sources */ = {isa = PBXBuildFile; fileRef = 8D89695B1C755D0200D32E8A /* main.m */; }; 8D89695F1C755D0200D32E8A /* AppDelegate.m in Sources */ = {isa = PBXBuildFile; fileRef = 8D89695E1C755D0200D32E8A /* AppDelegate.m */; }; - 8D8969621C755D0200D32E8A /* ViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = 8D8969611C755D0200D32E8A /* ViewController.m */; }; 8D8969651C755D0200D32E8A /* Main.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 8D8969631C755D0200D32E8A /* Main.storyboard */; }; 8D8969671C755D0200D32E8A /* Assets.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = 8D8969661C755D0200D32E8A /* Assets.xcassets */; }; 8D89696A1C755D0200D32E8A /* LaunchScreen.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 8D8969681C755D0200D32E8A /* LaunchScreen.storyboard */; }; + F7735DE21C7A0E4C00B6D2DA /* Topics.m in Sources */ = {isa = PBXBuildFile; fileRef = F7735DE11C7A0E4C00B6D2DA /* Topics.m */; }; + F7735DE81C7A125E00B6D2DA /* TopicsTVC.m in Sources */ = {isa = PBXBuildFile; fileRef = F7735DE71C7A125E00B6D2DA /* TopicsTVC.m */; }; + F7735DEB1C7A164A00B6D2DA /* TopicsDetailVC.m in Sources */ = {isa = PBXBuildFile; fileRef = F7735DEA1C7A164A00B6D2DA /* TopicsDetailVC.m */; }; + F7735DEE1C7A42E500B6D2DA /* TopicSelectionTableViewCell.m in Sources */ = {isa = PBXBuildFile; fileRef = F7735DED1C7A42E500B6D2DA /* TopicSelectionTableViewCell.m */; }; + F7735DF01C7A50AE00B6D2DA /* AVFoundation.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = F7735DEF1C7A50AE00B6D2DA /* AVFoundation.framework */; }; + F7735DF61C7A518800B6D2DA /* correct-answer.wav in Resources */ = {isa = PBXBuildFile; fileRef = F7735DF51C7A518800B6D2DA /* correct-answer.wav */; }; + F7735DFA1C7A51BF00B6D2DA /* skip.wav in Resources */ = {isa = PBXBuildFile; fileRef = F7735DF91C7A51BF00B6D2DA /* skip.wav */; }; + F7735DFC1C7A51DB00B6D2DA /* start-new-game.wav in Resources */ = {isa = PBXBuildFile; fileRef = F7735DFB1C7A51DB00B6D2DA /* start-new-game.wav */; }; + F7735DFE1C7A51E500B6D2DA /* game-over.wav in Resources */ = {isa = PBXBuildFile; fileRef = F7735DFD1C7A51E500B6D2DA /* game-over.wav */; }; + F7735E001C7A51FA00B6D2DA /* background-menu.wav in Resources */ = {isa = PBXBuildFile; fileRef = F7735DFF1C7A51FA00B6D2DA /* background-menu.wav */; }; + F7735E021C7A6E0D00B6D2DA /* 24 Tick Tock Effect.mp3 in Resources */ = {isa = PBXBuildFile; fileRef = F7735E011C7A6E0D00B6D2DA /* 24 Tick Tock Effect.mp3 */; }; /* End PBXBuildFile section */ /* Begin PBXFileReference section */ + 5F0297BB6D8F25F838E77565 /* libPods.a */ = {isa = PBXFileReference; explicitFileType = archive.ar; includeInIndex = 0; path = libPods.a; sourceTree = BUILT_PRODUCTS_DIR; }; 8D8969571C755D0200D32E8A /* HeadsUpper.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = HeadsUpper.app; sourceTree = BUILT_PRODUCTS_DIR; }; 8D89695B1C755D0200D32E8A /* main.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = main.m; sourceTree = ""; }; 8D89695D1C755D0200D32E8A /* AppDelegate.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = AppDelegate.h; sourceTree = ""; }; 8D89695E1C755D0200D32E8A /* AppDelegate.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = AppDelegate.m; sourceTree = ""; }; - 8D8969601C755D0200D32E8A /* ViewController.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = ViewController.h; sourceTree = ""; }; - 8D8969611C755D0200D32E8A /* ViewController.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = ViewController.m; sourceTree = ""; }; 8D8969641C755D0200D32E8A /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; name = Base; path = Base.lproj/Main.storyboard; sourceTree = ""; }; 8D8969661C755D0200D32E8A /* Assets.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; path = Assets.xcassets; sourceTree = ""; }; 8D8969691C755D0200D32E8A /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; name = Base; path = Base.lproj/LaunchScreen.storyboard; sourceTree = ""; }; 8D89696B1C755D0200D32E8A /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = ""; }; + 90C6B071CB6B528CC5F85B5B /* Pods.debug.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = Pods.debug.xcconfig; path = "Pods/Target Support Files/Pods/Pods.debug.xcconfig"; sourceTree = ""; }; + E27F89D42A4AAF4E1C8F8D5B /* Pods.release.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = Pods.release.xcconfig; path = "Pods/Target Support Files/Pods/Pods.release.xcconfig"; sourceTree = ""; }; + F7735DE01C7A0E4C00B6D2DA /* Topics.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = Topics.h; sourceTree = ""; }; + F7735DE11C7A0E4C00B6D2DA /* Topics.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = Topics.m; sourceTree = ""; }; + F7735DE61C7A125E00B6D2DA /* TopicsTVC.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = TopicsTVC.h; sourceTree = ""; }; + F7735DE71C7A125E00B6D2DA /* TopicsTVC.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = TopicsTVC.m; sourceTree = ""; }; + F7735DE91C7A164A00B6D2DA /* TopicsDetailVC.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = TopicsDetailVC.h; sourceTree = ""; }; + F7735DEA1C7A164A00B6D2DA /* TopicsDetailVC.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = TopicsDetailVC.m; sourceTree = ""; }; + F7735DEC1C7A42E500B6D2DA /* TopicSelectionTableViewCell.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = TopicSelectionTableViewCell.h; sourceTree = ""; }; + F7735DED1C7A42E500B6D2DA /* TopicSelectionTableViewCell.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = TopicSelectionTableViewCell.m; sourceTree = ""; }; + F7735DEF1C7A50AE00B6D2DA /* AVFoundation.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = AVFoundation.framework; path = System/Library/Frameworks/AVFoundation.framework; sourceTree = SDKROOT; }; + F7735DF51C7A518800B6D2DA /* correct-answer.wav */ = {isa = PBXFileReference; lastKnownFileType = audio.wav; name = "correct-answer.wav"; path = "../../../../../../Documents/Assets/FREE-GAME-ASSET-PACK/Audio/SFX/correct-answer.wav"; sourceTree = ""; }; + F7735DF91C7A51BF00B6D2DA /* skip.wav */ = {isa = PBXFileReference; lastKnownFileType = audio.wav; name = skip.wav; path = "../../../../../../Documents/Assets/FREE-GAME-ASSET-PACK/Audio/SFX/skip.wav"; sourceTree = ""; }; + F7735DFB1C7A51DB00B6D2DA /* start-new-game.wav */ = {isa = PBXFileReference; lastKnownFileType = audio.wav; name = "start-new-game.wav"; path = "../../../../../../Documents/Assets/FREE-GAME-ASSET-PACK/Audio/SFX/start-new-game.wav"; sourceTree = ""; }; + F7735DFD1C7A51E500B6D2DA /* game-over.wav */ = {isa = PBXFileReference; lastKnownFileType = audio.wav; name = "game-over.wav"; path = "../../../../../../Documents/Assets/FREE-GAME-ASSET-PACK/Audio/SFX/game-over.wav"; sourceTree = ""; }; + F7735DFF1C7A51FA00B6D2DA /* background-menu.wav */ = {isa = PBXFileReference; lastKnownFileType = audio.wav; name = "background-menu.wav"; path = "../../../../../../Documents/Assets/FREE-GAME-ASSET-PACK/Audio/SFX/background-menu.wav"; sourceTree = ""; }; + F7735E011C7A6E0D00B6D2DA /* 24 Tick Tock Effect.mp3 */ = {isa = PBXFileReference; lastKnownFileType = audio.mp3; name = "24 Tick Tock Effect.mp3"; path = "../../../../../../Downloads/24 Tick Tock Effect.mp3"; sourceTree = ""; }; /* End PBXFileReference section */ /* Begin PBXFrameworksBuildPhase section */ @@ -33,17 +60,39 @@ isa = PBXFrameworksBuildPhase; buildActionMask = 2147483647; files = ( + F7735DF01C7A50AE00B6D2DA /* AVFoundation.framework in Frameworks */, + 218377F1C84952A0ACDE493A /* libPods.a in Frameworks */, ); runOnlyForDeploymentPostprocessing = 0; }; /* End PBXFrameworksBuildPhase section */ /* Begin PBXGroup section */ + 2C7CC5F38065230B7F722383 /* Pods */ = { + isa = PBXGroup; + children = ( + 90C6B071CB6B528CC5F85B5B /* Pods.debug.xcconfig */, + E27F89D42A4AAF4E1C8F8D5B /* Pods.release.xcconfig */, + ); + name = Pods; + sourceTree = ""; + }; + 448F3D6E8E8AD42807BA1E68 /* Frameworks */ = { + isa = PBXGroup; + children = ( + 5F0297BB6D8F25F838E77565 /* libPods.a */, + ); + name = Frameworks; + sourceTree = ""; + }; 8D89694E1C755D0200D32E8A = { isa = PBXGroup; children = ( + F7735DEF1C7A50AE00B6D2DA /* AVFoundation.framework */, 8D8969591C755D0200D32E8A /* HeadsUpper */, 8D8969581C755D0200D32E8A /* Products */, + 2C7CC5F38065230B7F722383 /* Pods */, + 448F3D6E8E8AD42807BA1E68 /* Frameworks */, ); sourceTree = ""; }; @@ -58,10 +107,22 @@ 8D8969591C755D0200D32E8A /* HeadsUpper */ = { isa = PBXGroup; children = ( + F7735DFF1C7A51FA00B6D2DA /* background-menu.wav */, + F7735DF91C7A51BF00B6D2DA /* skip.wav */, + F7735DFB1C7A51DB00B6D2DA /* start-new-game.wav */, + F7735DFD1C7A51E500B6D2DA /* game-over.wav */, + F7735DF51C7A518800B6D2DA /* correct-answer.wav */, + F7735E011C7A6E0D00B6D2DA /* 24 Tick Tock Effect.mp3 */, 8D89695D1C755D0200D32E8A /* AppDelegate.h */, 8D89695E1C755D0200D32E8A /* AppDelegate.m */, - 8D8969601C755D0200D32E8A /* ViewController.h */, - 8D8969611C755D0200D32E8A /* ViewController.m */, + F7735DE01C7A0E4C00B6D2DA /* Topics.h */, + F7735DE11C7A0E4C00B6D2DA /* Topics.m */, + F7735DE61C7A125E00B6D2DA /* TopicsTVC.h */, + F7735DE71C7A125E00B6D2DA /* TopicsTVC.m */, + F7735DE91C7A164A00B6D2DA /* TopicsDetailVC.h */, + F7735DEA1C7A164A00B6D2DA /* TopicsDetailVC.m */, + F7735DEC1C7A42E500B6D2DA /* TopicSelectionTableViewCell.h */, + F7735DED1C7A42E500B6D2DA /* TopicSelectionTableViewCell.m */, 8D8969631C755D0200D32E8A /* Main.storyboard */, 8D8969661C755D0200D32E8A /* Assets.xcassets */, 8D8969681C755D0200D32E8A /* LaunchScreen.storyboard */, @@ -86,9 +147,11 @@ isa = PBXNativeTarget; buildConfigurationList = 8D89696E1C755D0200D32E8A /* Build configuration list for PBXNativeTarget "HeadsUpper" */; buildPhases = ( + 8CEEBD9E6BF9F84401417DF9 /* Check Pods Manifest.lock */, 8D8969531C755D0200D32E8A /* Sources */, 8D8969541C755D0200D32E8A /* Frameworks */, 8D8969551C755D0200D32E8A /* Resources */, + 2D62EBC922B9E1598DEA6C84 /* Copy Pods Resources */, ); buildRules = ( ); @@ -136,7 +199,13 @@ isa = PBXResourcesBuildPhase; buildActionMask = 2147483647; files = ( + F7735DFE1C7A51E500B6D2DA /* game-over.wav in Resources */, + F7735DF61C7A518800B6D2DA /* correct-answer.wav in Resources */, 8D89696A1C755D0200D32E8A /* LaunchScreen.storyboard in Resources */, + F7735E021C7A6E0D00B6D2DA /* 24 Tick Tock Effect.mp3 in Resources */, + F7735E001C7A51FA00B6D2DA /* background-menu.wav in Resources */, + F7735DFC1C7A51DB00B6D2DA /* start-new-game.wav in Resources */, + F7735DFA1C7A51BF00B6D2DA /* skip.wav in Resources */, 8D8969671C755D0200D32E8A /* Assets.xcassets in Resources */, 8D8969651C755D0200D32E8A /* Main.storyboard in Resources */, ); @@ -144,12 +213,48 @@ }; /* End PBXResourcesBuildPhase section */ +/* Begin PBXShellScriptBuildPhase section */ + 2D62EBC922B9E1598DEA6C84 /* Copy Pods Resources */ = { + isa = PBXShellScriptBuildPhase; + buildActionMask = 2147483647; + files = ( + ); + inputPaths = ( + ); + name = "Copy Pods Resources"; + outputPaths = ( + ); + runOnlyForDeploymentPostprocessing = 0; + shellPath = /bin/sh; + shellScript = "\"${SRCROOT}/Pods/Target Support Files/Pods/Pods-resources.sh\"\n"; + showEnvVarsInLog = 0; + }; + 8CEEBD9E6BF9F84401417DF9 /* Check Pods Manifest.lock */ = { + isa = PBXShellScriptBuildPhase; + buildActionMask = 2147483647; + files = ( + ); + inputPaths = ( + ); + name = "Check Pods Manifest.lock"; + outputPaths = ( + ); + runOnlyForDeploymentPostprocessing = 0; + shellPath = /bin/sh; + shellScript = "diff \"${PODS_ROOT}/../Podfile.lock\" \"${PODS_ROOT}/Manifest.lock\" > /dev/null\nif [[ $? != 0 ]] ; then\n cat << EOM\nerror: The sandbox is not in sync with the Podfile.lock. Run 'pod install' or update your CocoaPods installation.\nEOM\n exit 1\nfi\n"; + showEnvVarsInLog = 0; + }; +/* End PBXShellScriptBuildPhase section */ + /* Begin PBXSourcesBuildPhase section */ 8D8969531C755D0200D32E8A /* Sources */ = { isa = PBXSourcesBuildPhase; buildActionMask = 2147483647; files = ( - 8D8969621C755D0200D32E8A /* ViewController.m in Sources */, + F7735DEE1C7A42E500B6D2DA /* TopicSelectionTableViewCell.m in Sources */, + F7735DE81C7A125E00B6D2DA /* TopicsTVC.m in Sources */, + F7735DE21C7A0E4C00B6D2DA /* Topics.m in Sources */, + F7735DEB1C7A164A00B6D2DA /* TopicsDetailVC.m in Sources */, 8D89695F1C755D0200D32E8A /* AppDelegate.m in Sources */, 8D89695C1C755D0200D32E8A /* main.m in Sources */, ); @@ -259,10 +364,11 @@ }; 8D89696F1C755D0200D32E8A /* Debug */ = { isa = XCBuildConfiguration; + baseConfigurationReference = 90C6B071CB6B528CC5F85B5B /* Pods.debug.xcconfig */; buildSettings = { ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; INFOPLIST_FILE = HeadsUpper/Info.plist; - IPHONEOS_DEPLOYMENT_TARGET = 8.1; + IPHONEOS_DEPLOYMENT_TARGET = 9.2; LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks"; PRODUCT_BUNDLE_IDENTIFIER = com.mikekavouras.HeadsUpper; PRODUCT_NAME = "$(TARGET_NAME)"; @@ -271,10 +377,11 @@ }; 8D8969701C755D0200D32E8A /* Release */ = { isa = XCBuildConfiguration; + baseConfigurationReference = E27F89D42A4AAF4E1C8F8D5B /* Pods.release.xcconfig */; buildSettings = { ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; INFOPLIST_FILE = HeadsUpper/Info.plist; - IPHONEOS_DEPLOYMENT_TARGET = 8.1; + IPHONEOS_DEPLOYMENT_TARGET = 9.2; LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks"; PRODUCT_BUNDLE_IDENTIFIER = com.mikekavouras.HeadsUpper; PRODUCT_NAME = "$(TARGET_NAME)"; @@ -300,6 +407,7 @@ 8D8969701C755D0200D32E8A /* Release */, ); defaultConfigurationIsVisible = 0; + defaultConfigurationName = Release; }; /* End XCConfigurationList section */ }; diff --git a/HeadsUpper/HeadsUpper.xcworkspace/contents.xcworkspacedata b/HeadsUpper/HeadsUpper.xcworkspace/contents.xcworkspacedata new file mode 100644 index 0000000..9b6faaf --- /dev/null +++ b/HeadsUpper/HeadsUpper.xcworkspace/contents.xcworkspacedata @@ -0,0 +1,10 @@ + + + + + + + diff --git a/HeadsUpper/HeadsUpper/Assets.xcassets/Contents.json b/HeadsUpper/HeadsUpper/Assets.xcassets/Contents.json new file mode 100644 index 0000000..da4a164 --- /dev/null +++ b/HeadsUpper/HeadsUpper/Assets.xcassets/Contents.json @@ -0,0 +1,6 @@ +{ + "info" : { + "version" : 1, + "author" : "xcode" + } +} \ No newline at end of file diff --git a/HeadsUpper/HeadsUpper/Assets.xcassets/animals gone wild.imageset/Contents.json b/HeadsUpper/HeadsUpper/Assets.xcassets/animals gone wild.imageset/Contents.json new file mode 100644 index 0000000..d613c3a --- /dev/null +++ b/HeadsUpper/HeadsUpper/Assets.xcassets/animals gone wild.imageset/Contents.json @@ -0,0 +1,21 @@ +{ + "images" : [ + { + "idiom" : "universal", + "filename" : "animals.jpg", + "scale" : "1x" + }, + { + "idiom" : "universal", + "scale" : "2x" + }, + { + "idiom" : "universal", + "scale" : "3x" + } + ], + "info" : { + "version" : 1, + "author" : "xcode" + } +} \ No newline at end of file diff --git a/HeadsUpper/HeadsUpper/Assets.xcassets/animals gone wild.imageset/animals.jpg b/HeadsUpper/HeadsUpper/Assets.xcassets/animals gone wild.imageset/animals.jpg new file mode 100644 index 0000000..c54e3cf Binary files /dev/null and b/HeadsUpper/HeadsUpper/Assets.xcassets/animals gone wild.imageset/animals.jpg differ diff --git a/HeadsUpper/HeadsUpper/Assets.xcassets/hey mr. dj.imageset/Contents.json b/HeadsUpper/HeadsUpper/Assets.xcassets/hey mr. dj.imageset/Contents.json new file mode 100644 index 0000000..e97d5ce --- /dev/null +++ b/HeadsUpper/HeadsUpper/Assets.xcassets/hey mr. dj.imageset/Contents.json @@ -0,0 +1,21 @@ +{ + "images" : [ + { + "idiom" : "universal", + "filename" : "heymrdj.jpg", + "scale" : "1x" + }, + { + "idiom" : "universal", + "scale" : "2x" + }, + { + "idiom" : "universal", + "scale" : "3x" + } + ], + "info" : { + "version" : 1, + "author" : "xcode" + } +} \ No newline at end of file diff --git a/HeadsUpper/HeadsUpper/Assets.xcassets/hey mr. dj.imageset/heymrdj.jpg b/HeadsUpper/HeadsUpper/Assets.xcassets/hey mr. dj.imageset/heymrdj.jpg new file mode 100644 index 0000000..909d153 Binary files /dev/null and b/HeadsUpper/HeadsUpper/Assets.xcassets/hey mr. dj.imageset/heymrdj.jpg differ diff --git a/HeadsUpper/HeadsUpper/Assets.xcassets/icons.imageset/Contents.json b/HeadsUpper/HeadsUpper/Assets.xcassets/icons.imageset/Contents.json new file mode 100644 index 0000000..a7810a3 --- /dev/null +++ b/HeadsUpper/HeadsUpper/Assets.xcassets/icons.imageset/Contents.json @@ -0,0 +1,21 @@ +{ + "images" : [ + { + "idiom" : "universal", + "filename" : "icons.jpg", + "scale" : "1x" + }, + { + "idiom" : "universal", + "scale" : "2x" + }, + { + "idiom" : "universal", + "scale" : "3x" + } + ], + "info" : { + "version" : 1, + "author" : "xcode" + } +} \ No newline at end of file diff --git a/HeadsUpper/HeadsUpper/Assets.xcassets/icons.imageset/icons.jpg b/HeadsUpper/HeadsUpper/Assets.xcassets/icons.imageset/icons.jpg new file mode 100644 index 0000000..b8c33f3 Binary files /dev/null and b/HeadsUpper/HeadsUpper/Assets.xcassets/icons.imageset/icons.jpg differ diff --git a/HeadsUpper/HeadsUpper/Assets.xcassets/super stars.imageset/Contents.json b/HeadsUpper/HeadsUpper/Assets.xcassets/super stars.imageset/Contents.json new file mode 100644 index 0000000..ac1d9f6 --- /dev/null +++ b/HeadsUpper/HeadsUpper/Assets.xcassets/super stars.imageset/Contents.json @@ -0,0 +1,21 @@ +{ + "images" : [ + { + "idiom" : "universal", + "filename" : "superstar.jpg", + "scale" : "1x" + }, + { + "idiom" : "universal", + "scale" : "2x" + }, + { + "idiom" : "universal", + "scale" : "3x" + } + ], + "info" : { + "version" : 1, + "author" : "xcode" + } +} \ No newline at end of file diff --git a/HeadsUpper/HeadsUpper/Assets.xcassets/super stars.imageset/superstar.jpg b/HeadsUpper/HeadsUpper/Assets.xcassets/super stars.imageset/superstar.jpg new file mode 100644 index 0000000..a2f8c5d Binary files /dev/null and b/HeadsUpper/HeadsUpper/Assets.xcassets/super stars.imageset/superstar.jpg differ diff --git a/HeadsUpper/HeadsUpper/Assets.xcassets/that's so 90s.imageset/Contents.json b/HeadsUpper/HeadsUpper/Assets.xcassets/that's so 90s.imageset/Contents.json new file mode 100644 index 0000000..adb7452 --- /dev/null +++ b/HeadsUpper/HeadsUpper/Assets.xcassets/that's so 90s.imageset/Contents.json @@ -0,0 +1,21 @@ +{ + "images" : [ + { + "idiom" : "universal", + "filename" : "thenineties.png", + "scale" : "1x" + }, + { + "idiom" : "universal", + "scale" : "2x" + }, + { + "idiom" : "universal", + "scale" : "3x" + } + ], + "info" : { + "version" : 1, + "author" : "xcode" + } +} \ No newline at end of file diff --git a/HeadsUpper/HeadsUpper/Assets.xcassets/that's so 90s.imageset/thenineties.png b/HeadsUpper/HeadsUpper/Assets.xcassets/that's so 90s.imageset/thenineties.png new file mode 100644 index 0000000..bddab40 Binary files /dev/null and b/HeadsUpper/HeadsUpper/Assets.xcassets/that's so 90s.imageset/thenineties.png differ diff --git a/HeadsUpper/HeadsUpper/Base.lproj/LaunchScreen.storyboard b/HeadsUpper/HeadsUpper/Base.lproj/LaunchScreen.storyboard index 2e721e1..78686cd 100644 --- a/HeadsUpper/HeadsUpper/Base.lproj/LaunchScreen.storyboard +++ b/HeadsUpper/HeadsUpper/Base.lproj/LaunchScreen.storyboard @@ -1,7 +1,8 @@ - + - + + @@ -15,7 +16,6 @@ - diff --git a/HeadsUpper/HeadsUpper/Base.lproj/Main.storyboard b/HeadsUpper/HeadsUpper/Base.lproj/Main.storyboard index f56d2f3..6d7d64b 100644 --- a/HeadsUpper/HeadsUpper/Base.lproj/Main.storyboard +++ b/HeadsUpper/HeadsUpper/Base.lproj/Main.storyboard @@ -1,25 +1,141 @@ - + - + + + - - + + - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - - + + - + - + + + + + + + + + + + + + + + + + - + + + + + + + + + + + + + + + + + + + + + + + diff --git a/HeadsUpper/HeadsUpper/TopicSelectionTableViewCell.h b/HeadsUpper/HeadsUpper/TopicSelectionTableViewCell.h new file mode 100644 index 0000000..6d88d99 --- /dev/null +++ b/HeadsUpper/HeadsUpper/TopicSelectionTableViewCell.h @@ -0,0 +1,16 @@ +// +// TopicSelectionTableViewCell.h +// HeadsUpper +// +// Created by Christella on 2/21/16. +// Copyright © 2016 Michael Kavouras. All rights reserved. +// + +#import + +@interface TopicSelectionTableViewCell : UITableViewCell + +@property (weak, nonatomic) IBOutlet UIImageView *topicsImg; +@property (weak, nonatomic) IBOutlet UILabel *topicLbl; + +@end diff --git a/HeadsUpper/HeadsUpper/TopicSelectionTableViewCell.m b/HeadsUpper/HeadsUpper/TopicSelectionTableViewCell.m new file mode 100644 index 0000000..03acbc9 --- /dev/null +++ b/HeadsUpper/HeadsUpper/TopicSelectionTableViewCell.m @@ -0,0 +1,32 @@ +// +// TopicSelectionTableViewCell.m +// HeadsUpper +// +// Created by Christella on 2/21/16. +// Copyright © 2016 Michael Kavouras. All rights reserved. +// + +#import "TopicSelectionTableViewCell.h" + +@implementation TopicSelectionTableViewCell + +- (void)awakeFromNib { + + CGFloat borderWidth = 10.0f; + + self.topicsImg.frame = CGRectInset(self.frame, -borderWidth, -borderWidth); + self.topicsImg.layer.borderColor = [UIColor colorWithRed:197.0/255.0 green:111.0/255.0 blue:251.0/255.0 alpha:1].CGColor; + self.topicsImg.layer.borderWidth = borderWidth; + + self.topicsImg.layer.cornerRadius = 20.0; + self.topicsImg.clipsToBounds = YES; + +} + +- (void)setSelected:(BOOL)selected animated:(BOOL)animated { + [super setSelected:selected animated:animated]; + + // Configure the view for the selected state +} + +@end diff --git a/HeadsUpper/HeadsUpper/Topics.h b/HeadsUpper/HeadsUpper/Topics.h new file mode 100644 index 0000000..7f33345 --- /dev/null +++ b/HeadsUpper/HeadsUpper/Topics.h @@ -0,0 +1,16 @@ +// +// Topics.h +// HeadsUpper +// +// Created by Christella on 2/21/16. +// Copyright © 2016 Michael Kavouras. All rights reserved. +// + +#import + +@interface Topics : NSObject + +@property (nonatomic) NSString * topicName; +@property (nonatomic) NSArray * topicClues; + +@end diff --git a/HeadsUpper/HeadsUpper/Topics.m b/HeadsUpper/HeadsUpper/Topics.m new file mode 100644 index 0000000..380291f --- /dev/null +++ b/HeadsUpper/HeadsUpper/Topics.m @@ -0,0 +1,14 @@ +// +// Topics.m +// HeadsUpper +// +// Created by Christella on 2/21/16. +// Copyright © 2016 Michael Kavouras. All rights reserved. +// + +#import "Topics.h" + +@implementation Topics + + +@end diff --git a/HeadsUpper/HeadsUpper/TopicsDetailVC.h b/HeadsUpper/HeadsUpper/TopicsDetailVC.h new file mode 100644 index 0000000..8ce8c03 --- /dev/null +++ b/HeadsUpper/HeadsUpper/TopicsDetailVC.h @@ -0,0 +1,19 @@ +// +// TopicsDetailVC.h +// HeadsUpper +// +// Created by Christella on 2/21/16. +// Copyright © 2016 Michael Kavouras. All rights reserved. +// + +#import +#import "Topics.h" +#import "TopicsTVC.h" + +@interface TopicsDetailVC : UIViewController + +@property (weak, nonatomic) IBOutlet UILabel *topicsClueLbl; +@property (weak, nonatomic) NSString *topicName; +@property (nonatomic) Topics *clues; + +@end diff --git a/HeadsUpper/HeadsUpper/TopicsDetailVC.m b/HeadsUpper/HeadsUpper/TopicsDetailVC.m new file mode 100644 index 0000000..e96da75 --- /dev/null +++ b/HeadsUpper/HeadsUpper/TopicsDetailVC.m @@ -0,0 +1,191 @@ +// +// TopicsDetailVC.m +// HeadsUpper +// +// Created by Christella on 2/21/16. +// Copyright © 2016 Michael Kavouras. All rights reserved. +// + +#import "TopicsDetailVC.h" +#import "TopicsTVC.h" +#import +#import "NYAlertViewController.h" + + +@interface TopicsDetailVC () + +@property (nonatomic) NSArray *topicClueList; + +@property (nonatomic) NSTimer *changeBgColourTimer; +@property (nonatomic, assign) NSInteger timerCount; +@property (weak, nonatomic) IBOutlet UILabel *timerLbl; + +@property (nonatomic, assign) NSInteger totalClues; +@property (nonatomic, assign) NSInteger cluesCorrect; +@property (nonatomic, assign) NSInteger cluesWrong; + +@property(nonatomic, strong) AVAudioPlayer *backgroundMusic; + +@end + +@implementation TopicsDetailVC + +- (void)viewDidLoad { + [super viewDidLoad]; + [self setupGestureRecognizers]; + [self generateClue]; + [self setupTimer]; +} + +-(void) playWinSound { + NSURL *musicFile = [[NSBundle mainBundle] URLForResource:@"correct-answer" + withExtension:@"wav"]; + self.backgroundMusic = [[AVAudioPlayer alloc] initWithContentsOfURL:musicFile + error:nil]; + self.backgroundMusic.numberOfLoops = 0; + [self.backgroundMusic play]; +} + +-(void) playlossSound { + NSURL *musicFile = [[NSBundle mainBundle] URLForResource:@"skip" + withExtension:@"wav"]; + self.backgroundMusic = [[AVAudioPlayer alloc] initWithContentsOfURL:musicFile + error:nil]; + self.backgroundMusic.numberOfLoops = 0; + [self.backgroundMusic play]; +} + +-(void) playGameOver{ + NSURL *musicFile = [[NSBundle mainBundle] URLForResource:@"game-over" + withExtension:@"wav"]; + self.backgroundMusic = [[AVAudioPlayer alloc] initWithContentsOfURL:musicFile + error:nil]; + self.backgroundMusic.numberOfLoops = 0; + [self.backgroundMusic play]; +} + + +-(void)setupTimer { + NSTimer *timer = [NSTimer timerWithTimeInterval:1.0 target:self selector:@selector(timerFired:) userInfo:nil repeats:YES]; + [[NSRunLoop currentRunLoop]addTimer:timer forMode:NSRunLoopCommonModes]; + + self.timerCount = 30; + + [timer fire]; +} + +-(void) generateClue { + self.topicClueList = self.clues.topicClues; + + uint32_t rnd = arc4random_uniform([self.clues.topicClues count]); + + NSString *randomObject = [self.clues.topicClues objectAtIndex:rnd]; + + self.topicsClueLbl.text = randomObject; +} + +-(void) setupGestureRecognizers { + UISwipeGestureRecognizer *leftSwipe = [[UISwipeGestureRecognizer alloc]initWithTarget:self action:@selector(handleSwipe:)]; + leftSwipe.direction = UISwipeGestureRecognizerDirectionLeft; + + UISwipeGestureRecognizer *rightSwipe = [[UISwipeGestureRecognizer alloc]initWithTarget:self action:@selector(handleSwipe:)]; + rightSwipe.direction = UISwipeGestureRecognizerDirectionRight; + + + [self.view addGestureRecognizer:leftSwipe]; + [self.view addGestureRecognizer:rightSwipe]; +} + +-(void) bGColourTimer { + self.changeBgColourTimer = [NSTimer scheduledTimerWithTimeInterval:.1 target:self selector:@selector(changeBackground) userInfo:nil repeats:YES]; +} + +-(void) changeBackground { + [UIView animateWithDuration:.2 animations:^{ + self.view.backgroundColor = [UIColor colorWithRed:31.0/255.0 green:33.0/255.0 blue:36.0/255.0 alpha:1]; + } completion:NULL]; +} + +-(void)handleSwipe:(UISwipeGestureRecognizer *)gesture { + switch (gesture.direction ) { + case UISwipeGestureRecognizerDirectionLeft: + self.view.backgroundColor = [UIColor greenColor]; + [self bGColourTimer]; + [self generateClue]; + [self playWinSound]; + self.totalClues++; + break; + case UISwipeGestureRecognizerDirectionRight: + self.view.backgroundColor = [UIColor redColor]; + [self bGColourTimer]; + [self generateClue]; + [self playlossSound]; + self.totalClues++; + self.cluesWrong++; + break; + default: + return; + } +} + +-(void)gameOverAlert { + + self.cluesCorrect = self.totalClues - self.cluesWrong; + + NSString *totalClues = [NSString stringWithFormat:@"%li", (long)self.totalClues]; + NSString *cluesCorrect = [NSString stringWithFormat:@"%li", (long)self.cluesCorrect]; + NSString *playerResult = [NSString stringWithFormat:@"%@/%@", cluesCorrect, totalClues]; + + NYAlertViewController *alertViewController = [[NYAlertViewController alloc] initWithNibName:nil bundle:nil]; + + // Set a title and message + alertViewController.title = NSLocalizedString(@"Game Over", nil); + alertViewController.message = NSLocalizedString(playerResult, nil); + + // Customize appearance as desired + alertViewController.buttonCornerRadius = 20.0f; + alertViewController.view.tintColor = self.view.tintColor; + + alertViewController.titleFont = [UIFont fontWithName:@"AvenirNext-Bold" size:19.0f]; + alertViewController.messageFont = [UIFont fontWithName:@"AvenirNext-Medium" size:16.0f]; + alertViewController.cancelButtonTitleFont = [UIFont fontWithName:@"AvenirNext-Medium" size:alertViewController.cancelButtonTitleFont.pointSize]; + + alertViewController.swipeDismissalGestureEnabled = YES; + alertViewController.backgroundTapDismissalGestureEnabled = YES; + + alertViewController.alertViewBackgroundColor = [UIColor colorWithRed:31.0/255.0 green:33.0/255.0 blue:36.0/255.0 alpha:1]; + alertViewController.titleColor = [UIColor colorWithRed:197.0/255.0 green:111.0/255.0 blue:251.0/255.0 alpha:1]; + alertViewController.messageColor = [UIColor whiteColor]; + alertViewController.cancelButtonColor = [UIColor colorWithRed:197.0/255.0 green:111.0/255.0 blue:251.0/255.0 alpha:1]; + + // Add alert actions + [alertViewController addAction:[NYAlertAction actionWithTitle:NSLocalizedString(@"Done", nil) + style:UIAlertActionStyleCancel + handler:^(NYAlertAction *action) { + [self dismissViewControllerAnimated:YES completion:nil]; + }]]; + + // Present the alert view controller + [self presentViewController:alertViewController animated:YES completion:nil]; +} + +-(void)timerFired:(NSTimer *)timer { + if (self.timerCount == 0) { + [timer invalidate]; + [self gameOverAlert]; + [self playGameOver]; + } + + //determine time left on timer + NSString *convertedToString = [[NSNumber numberWithInteger:self.timerCount]stringValue]; + self.timerLbl.text = convertedToString; + + self.timerCount--; +} + +- (void)didReceiveMemoryWarning { + [super didReceiveMemoryWarning]; + // Dispose of any resources that can be recreated. +} + +@end diff --git a/HeadsUpper/HeadsUpper/ViewController.h b/HeadsUpper/HeadsUpper/TopicsTVC.h similarity index 51% rename from HeadsUpper/HeadsUpper/ViewController.h rename to HeadsUpper/HeadsUpper/TopicsTVC.h index 65d6cf5..73210f9 100644 --- a/HeadsUpper/HeadsUpper/ViewController.h +++ b/HeadsUpper/HeadsUpper/TopicsTVC.h @@ -1,15 +1,13 @@ // -// ViewController.h +// TopicsTVC.h // HeadsUpper // -// Created by Michael Kavouras on 2/17/16. +// Created by Christella on 2/21/16. // Copyright © 2016 Michael Kavouras. All rights reserved. // #import -@interface ViewController : UIViewController - +@interface TopicsTVC : UITableViewController @end - diff --git a/HeadsUpper/HeadsUpper/TopicsTVC.m b/HeadsUpper/HeadsUpper/TopicsTVC.m new file mode 100644 index 0000000..27e1144 --- /dev/null +++ b/HeadsUpper/HeadsUpper/TopicsTVC.m @@ -0,0 +1,123 @@ +// +// TopicsTVC.m +// HeadsUpper +// +// Created by Christella on 2/21/16. +// Copyright © 2016 Michael Kavouras. All rights reserved. +// + +#import "TopicsTVC.h" +#import "TopicsDetailVC.h" +#import "Topics.h" +#import "TopicSelectionTableViewCell.h" +#import + +@interface TopicsTVC () + +@property (nonatomic) NSArray * topics; + +@property(nonatomic, strong) AVAudioPlayer *backgroundMusic; + +@end + +@implementation TopicsTVC + +- (void)viewDidLoad { + [super viewDidLoad]; + [self setupTopicsData]; +} + +- (void)viewDidAppear:(BOOL)animated { + [self.tableView reloadData]; + [self playMusic]; +} + +-(void) playMusic { + NSURL *musicFile = [[NSBundle mainBundle] URLForResource:@"background-menu" + withExtension:@"wav"]; + self.backgroundMusic = [[AVAudioPlayer alloc] initWithContentsOfURL:musicFile + error:nil]; + self.backgroundMusic.numberOfLoops = -1; + [self.backgroundMusic play]; + +} + +-(void) playNewGameSound { + NSURL *musicFile = [[NSBundle mainBundle] URLForResource:@"start-new-game" + withExtension:@"wav"]; + self.backgroundMusic = [[AVAudioPlayer alloc] initWithContentsOfURL:musicFile + error:nil]; + self.backgroundMusic.numberOfLoops = 0; + [self.backgroundMusic play]; +} + +- (void)didReceiveMemoryWarning { + [super didReceiveMemoryWarning]; + +} + +#pragma mark - The Data + +-(void) setupTopicsData { + + Topics *superStars = [[Topics alloc]init]; + Topics *thatsSoNineties = [[Topics alloc]init]; + Topics *heyMrDJ = [[Topics alloc]init]; + Topics *icons = [[Topics alloc]init]; + Topics *animalsGoneWild = [[Topics alloc]init]; + + superStars.topicName = @"Super Stars"; + superStars.topicClues = @[@"Janet Jackson", @"Leighton Meester", @"Willow Smith", @"Matt Lauer", @"Josh Duhamel", @"Sharon Osbourne", @"Spencer Pratt", @"Demi Moore", @"Whitney Houston", @"Nicole Kidman", @"Miley Cyrus", @"Victoria Beckham", @"LeAnn Rimes", @"Dakota Fanning", @"Dr. Seuss", @"Ryan Phillippe", @"Steve Carell", @"Chris Rock", @"Collin Ferell", @"Drake", @"Rachel McAdams", @"Maya Rudolph"]; + + thatsSoNineties.topicName = @"That's so 90s"; + thatsSoNineties.topicClues = @[@"El Niño", @"Viagra", @"Animaniacs", @"League of their Own", @"Happy Gilmore", @"Nick Carter", @"My Heart Will Go On", @"I Know What You Did Last Summer", @"Can You Feel The Love Tonight", @"The Macarana", @"Light-up Sneakers", @"Boy Meets World", @"Baby Got Back", @"Smells Like Teen Spirit", @"Super Soakers", @"7th Heaven", @"Garth Brooks", @"Floppy Discs", @"Kramer", @"Blink 182", @"Surge"]; + + heyMrDJ.topicName = @"Hey Mr. DJ"; + heyMrDJ.topicClues = @[@"\"Girl On Fire\" Alicia Keys", @"\"U Can't Touch This\" MC Hammer", @"\"Hello\" Lionel Richie", @"\"Dark Horse\" Katy Perry", @"\"Someboyd To Love\" Queen", @"\"No Scrubs\" TLC", @"\"Happy\" Pharrell Williams", @"\"Piano Man\" Billy Joel", @"\"Blurred Lines\" Robin Thicke", @"\"Fantasy\" Mariah Carey", @"\"I Will Survive\" Gloria Gaynor", @"\"Come and Get it\" Selena Gomez", @"\"Halo\" Beyonce", @"\"I Believe I Can Fly\" R.Kelly", @"\"The Sign\" Ace of Base", @"\"Diamonds\" Rihanna", @"\"A Thousand Miles\" Vanessa Carlton", @"\"What a Wonderful World\" Louis Armstrong", @"\"We Belong Together\" Mariah Carey", @"\"(I Can't Get No) Satisfaction\""]; + + icons.topicName = @"Icons"; + icons.topicClues = @[@"Colin Farrell", @"Mozart", @"Billy Joel", @"Judy Garland", @"Napoleon Bonaparte", @"Queen Elizabeth II", @"Fred Armisen", @"Henry Ford", @"Jon Lovitz", @"Julia Child", @"Catherine the Great", @"Magic Johnson", @"Uma Thurman", @"Orson Welles", @"Kathy Bates", @"George Orwell", @"Billy Crystal", @"Farrah Fawcett", @"Gary Busey", @"Chris Farley", @"Tom Selleck", @"Alexander the Great"]; + + animalsGoneWild.topicName = @"Animals Gone Wild"; + animalsGoneWild.topicClues = @[@"Chipmunk", @"Dragon", @"Wasp", @"Snake", @"Jellyfish", @"Emu", @"Boar", @"Crocodile", @"Shrimp", @"Lemur", @"Caterpillar", @"Sea Urchain", @"Dolphin ", @"Camel", @"Viper", @"Fox", @"Tuna", @"Baboon", @"Chinchilla", @"Human", @"Crawfish", @"Cricket", @"Frog", @"Tiger", @"Guinea Pig", @"Gnat", @"Killer Whale", @"Coral", @"T-Rex", @"Oyster"]; + + self.topics = @[superStars, thatsSoNineties, heyMrDJ, icons, animalsGoneWild]; +} + +#pragma mark - Table view data source + +- (NSInteger)numberOfSectionsInTableView:(UITableView *)tableView { + return 1; +} + +- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section { + return self.topics.count; +} + +- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath { + TopicSelectionTableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:@"TopicsCell" forIndexPath:indexPath]; + + Topics *topics = [self.topics objectAtIndex: indexPath.row]; + cell.topicLbl.text = topics.topicName; + + cell.topicsImg.image = [UIImage imageNamed:[topics.topicName lowercaseString]]; + + return cell; +} + +#pragma mark - Navigation + +- (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender { + [self.backgroundMusic stop]; + [self playNewGameSound]; + + TopicsDetailVC *topicsClue = segue.destinationViewController; + + NSIndexPath *indexPath = [self.tableView indexPathForSelectedRow]; + + Topics *newCategory = [self.topics objectAtIndex:indexPath.row]; + + topicsClue.clues = newCategory; +} + +@end diff --git a/HeadsUpper/HeadsUpper/ViewController.m b/HeadsUpper/HeadsUpper/ViewController.m deleted file mode 100644 index 14ce57a..0000000 --- a/HeadsUpper/HeadsUpper/ViewController.m +++ /dev/null @@ -1,27 +0,0 @@ -// -// ViewController.m -// HeadsUpper -// -// Created by Michael Kavouras on 2/17/16. -// Copyright © 2016 Michael Kavouras. All rights reserved. -// - -#import "ViewController.h" - -@interface ViewController () - -@end - -@implementation ViewController - -- (void)viewDidLoad { - [super viewDidLoad]; - // Do any additional setup after loading the view, typically from a nib. -} - -- (void)didReceiveMemoryWarning { - [super didReceiveMemoryWarning]; - // Dispose of any resources that can be recreated. -} - -@end diff --git a/HeadsUpper/Podfile b/HeadsUpper/Podfile new file mode 100644 index 0000000..c523942 --- /dev/null +++ b/HeadsUpper/Podfile @@ -0,0 +1 @@ +pod 'NYAlertViewController' diff --git a/HeadsUpper/Podfile.lock b/HeadsUpper/Podfile.lock new file mode 100644 index 0000000..66a96ee --- /dev/null +++ b/HeadsUpper/Podfile.lock @@ -0,0 +1,10 @@ +PODS: + - NYAlertViewController (1.3.0) + +DEPENDENCIES: + - NYAlertViewController + +SPEC CHECKSUMS: + NYAlertViewController: b93f82e2c1fc6d5e9485512ddbe7b481f463a074 + +COCOAPODS: 0.38.2 diff --git a/HeadsUpper/Pods/Headers/Private/NYAlertViewController/NYAlertView.h b/HeadsUpper/Pods/Headers/Private/NYAlertViewController/NYAlertView.h new file mode 120000 index 0000000..3527370 --- /dev/null +++ b/HeadsUpper/Pods/Headers/Private/NYAlertViewController/NYAlertView.h @@ -0,0 +1 @@ +../../../NYAlertViewController/NYAlertViewController/NYAlertView.h \ No newline at end of file diff --git a/HeadsUpper/Pods/Headers/Private/NYAlertViewController/NYAlertViewController.h b/HeadsUpper/Pods/Headers/Private/NYAlertViewController/NYAlertViewController.h new file mode 120000 index 0000000..7061264 --- /dev/null +++ b/HeadsUpper/Pods/Headers/Private/NYAlertViewController/NYAlertViewController.h @@ -0,0 +1 @@ +../../../NYAlertViewController/NYAlertViewController/NYAlertViewController.h \ No newline at end of file diff --git a/HeadsUpper/Pods/Headers/Public/NYAlertViewController/NYAlertView.h b/HeadsUpper/Pods/Headers/Public/NYAlertViewController/NYAlertView.h new file mode 120000 index 0000000..3527370 --- /dev/null +++ b/HeadsUpper/Pods/Headers/Public/NYAlertViewController/NYAlertView.h @@ -0,0 +1 @@ +../../../NYAlertViewController/NYAlertViewController/NYAlertView.h \ No newline at end of file diff --git a/HeadsUpper/Pods/Headers/Public/NYAlertViewController/NYAlertViewController.h b/HeadsUpper/Pods/Headers/Public/NYAlertViewController/NYAlertViewController.h new file mode 120000 index 0000000..7061264 --- /dev/null +++ b/HeadsUpper/Pods/Headers/Public/NYAlertViewController/NYAlertViewController.h @@ -0,0 +1 @@ +../../../NYAlertViewController/NYAlertViewController/NYAlertViewController.h \ No newline at end of file diff --git a/HeadsUpper/Pods/Manifest.lock b/HeadsUpper/Pods/Manifest.lock new file mode 100644 index 0000000..66a96ee --- /dev/null +++ b/HeadsUpper/Pods/Manifest.lock @@ -0,0 +1,10 @@ +PODS: + - NYAlertViewController (1.3.0) + +DEPENDENCIES: + - NYAlertViewController + +SPEC CHECKSUMS: + NYAlertViewController: b93f82e2c1fc6d5e9485512ddbe7b481f463a074 + +COCOAPODS: 0.38.2 diff --git a/HeadsUpper/Pods/NYAlertViewController/LICENSE.md b/HeadsUpper/Pods/NYAlertViewController/LICENSE.md new file mode 100644 index 0000000..a7b41d5 --- /dev/null +++ b/HeadsUpper/Pods/NYAlertViewController/LICENSE.md @@ -0,0 +1,21 @@ +The MIT License (MIT) + +Copyright (c) 2014 Nealon Young + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. diff --git a/HeadsUpper/Pods/NYAlertViewController/NYAlertViewController/NYAlertView.h b/HeadsUpper/Pods/NYAlertViewController/NYAlertViewController/NYAlertView.h new file mode 100644 index 0000000..f220c85 --- /dev/null +++ b/HeadsUpper/Pods/NYAlertViewController/NYAlertViewController/NYAlertView.h @@ -0,0 +1,58 @@ +// +// NYAlertView.h +// +// Created by Nealon Young on 7/13/15. +// Copyright (c) 2015 Nealon Young. All rights reserved. +// + +#import + +typedef NS_ENUM(NSInteger, NYAlertViewButtonType) { + NYAlertViewButtonTypeFilled, + NYAlertViewButtonTypeBordered +}; + +@interface UIButton (BackgroundColor) + +- (void)setBackgroundColor:(UIColor *)color forState:(UIControlState)state; + +@end + +@interface NYAlertViewButton : UIButton + +@property (nonatomic) NYAlertViewButtonType type; + +@property (nonatomic) CGFloat cornerRadius; + +@end + +@interface NYAlertView : UIView + +@property UILabel *titleLabel; +@property UITextView *messageTextView; +@property (nonatomic) UIView *contentView; + +@property (nonatomic) UIFont *buttonTitleFont; +@property (nonatomic) UIFont *cancelButtonTitleFont; +@property (nonatomic) UIFont *destructiveButtonTitleFont; + +@property (nonatomic) UIColor *buttonColor; +@property (nonatomic) UIColor *buttonTitleColor; +@property (nonatomic) UIColor *cancelButtonColor; +@property (nonatomic) UIColor *cancelButtonTitleColor; +@property (nonatomic) UIColor *destructiveButtonColor; +@property (nonatomic) UIColor *destructiveButtonTitleColor; + +@property (nonatomic) CGFloat buttonCornerRadius; +@property (nonatomic) CGFloat maximumWidth; + +@property (nonatomic, readonly) UIView *alertBackgroundView; + +@property (nonatomic, readonly) NSLayoutConstraint *backgroundViewVerticalCenteringConstraint; + +//@property (nonatomic) NSArray *actions; +@property (nonatomic) NSArray *actionButtons; + +@property (nonatomic) NSArray *textFields; + +@end diff --git a/HeadsUpper/Pods/NYAlertViewController/NYAlertViewController/NYAlertView.m b/HeadsUpper/Pods/NYAlertViewController/NYAlertViewController/NYAlertView.m new file mode 100644 index 0000000..227d52f --- /dev/null +++ b/HeadsUpper/Pods/NYAlertViewController/NYAlertViewController/NYAlertView.m @@ -0,0 +1,567 @@ +// +// NYAlertView.m +// +// Created by Nealon Young on 7/13/15. +// Copyright (c) 2015 Nealon Young. All rights reserved. +// + +#import "NYAlertView.h" + +#import "NYAlertViewController.h" + +@interface NYAlertTextView : UITextView + +@end + +@implementation NYAlertTextView + +- (instancetype)initWithFrame:(CGRect)frame textContainer:(NSTextContainer *)textContainer { + self = [super initWithFrame:frame textContainer:textContainer]; + + self.textContainerInset = UIEdgeInsetsZero; + + return self; +} + +- (void)layoutSubviews { + [super layoutSubviews]; + + if (!CGSizeEqualToSize(self.bounds.size, [self intrinsicContentSize])) { + [self invalidateIntrinsicContentSize]; + } +} + +- (CGSize)intrinsicContentSize { + if ([self.text length]) { + return self.contentSize; + } else { + return CGSizeZero; + } +} + +@end + +@implementation UIButton (BackgroundColor) + +- (void)setBackgroundColor:(UIColor *)color forState:(UIControlState)state { + [self setBackgroundImage:[self imageWithColor:color] forState:state]; +} + +- (UIImage *)imageWithColor:(UIColor *)color { + CGRect rect = CGRectMake(0.0f, 0.0f, 1.0f, 1.0f); + UIGraphicsBeginImageContext(rect.size); + CGContextRef context = UIGraphicsGetCurrentContext(); + + CGContextSetFillColorWithColor(context, [color CGColor]); + CGContextFillRect(context, rect); + + UIImage *image = UIGraphicsGetImageFromCurrentImageContext(); + UIGraphicsEndImageContext(); + + return image; +} + +@end + +@implementation NYAlertViewButton + ++ (id)buttonWithType:(UIButtonType)buttonType { + return [super buttonWithType:UIButtonTypeCustom]; +} + +- (instancetype)initWithCoder:(NSCoder *)aDecoder { + self = [super initWithCoder:aDecoder]; + + if (self) { + [self commonInit]; + } + + return self; +} + +- (id)initWithFrame:(CGRect)frame { + self = [super initWithFrame:frame]; + + if (self) { + [self commonInit]; + } + + return self; +} + +- (void)commonInit { + self.layer.rasterizationScale = [[UIScreen mainScreen] scale]; + self.layer.shouldRasterize = YES; + + self.layer.borderWidth = 1.0f; + + self.cornerRadius = 4.0f; + self.clipsToBounds = YES; + + [self setTitleColor:[UIColor whiteColor] forState:UIControlStateNormal]; + [self setTitleColor:[UIColor whiteColor] forState:UIControlStateHighlighted]; + [self setTitleColor:[UIColor whiteColor] forState:UIControlStateDisabled]; + + [self tintColorDidChange]; +} + +- (void)setHidden:(BOOL)hidden { + [super setHidden:hidden]; + [self invalidateIntrinsicContentSize]; +} + +- (void)setEnabled:(BOOL)enabled { + [super setEnabled:enabled]; + +// if (!enabled) { +// self.backgroundColor = [UIColor lightGrayColor]; +// self.layer.borderColor = self.tintColor.CGColor; +// [self setTitleColor:[UIColor darkGrayColor] forState:UIControlStateNormal]; +// } else { +// self.backgroundColor = self.tintColor; +// self.layer.borderColor = self.tintColor.CGColor; +// [self setTitleColor:[UIColor whiteColor] forState:UIControlStateNormal]; +// } +} + +- (void)tintColorDidChange { + [super tintColorDidChange]; + + if (self.type == NYAlertViewButtonTypeFilled) { + if (self.enabled) { + [self setBackgroundColor:self.tintColor]; + } + } else { + [self setTitleColor:self.tintColor forState:UIControlStateNormal]; + } + + self.layer.borderColor = self.tintColor.CGColor; + + [self setNeedsDisplay]; +} + +- (CGFloat)cornerRadius { + return self.layer.cornerRadius; +} + +- (void)setCornerRadius:(CGFloat)cornerRadius { + self.layer.cornerRadius = cornerRadius; +} + +//- (void)setEnabled:(BOOL)enabled { +// [super setEnabled:enabled]; +// +// if (enabled) { +// self.layer.backgroundColor = self.tintColor.CGColor; +// [self setTitleColor:[UIColor whiteColor] forState:UIControlStateNormal]; +// } else { +// self.layer.backgroundColor = [UIColor lightGrayColor].CGColor; +// [self setTitleColor:[UIColor darkGrayColor] forState:UIControlStateNormal]; +// } +//} + +//- (void)setType:(NYAlertViewButtonType)type { +// _type = type; +// +// if (type == NYAlertViewButtonTypeBordered) { +// self.layer.backgroundColor = [UIColor clearColor].CGColor; +// [self setTitleColor:self.tintColor forState:UIControlStateNormal]; +// } else { +// self.layer.backgroundColor = self.tintColor.CGColor; +// [self setTitleColor:[UIColor whiteColor] forState:UIControlStateNormal]; +// } +//} + +- (CGSize)intrinsicContentSize { + if (self.hidden) { + return CGSizeZero; + } + + return CGSizeMake([super intrinsicContentSize].width + 12.0f, 30.0f); +} + +- (void)touchesBegan:(NSSet *)touches withEvent:(UIEvent *)event { + [super touchesBegan:touches withEvent:event]; + [self setNeedsDisplay]; +} + +- (void)touchesMoved:(NSSet *)touches withEvent:(UIEvent *)event { + [super touchesMoved:touches withEvent:event]; + [self setNeedsDisplay]; +} + +- (void)touchesEnded:(NSSet *)touches withEvent:(UIEvent *)event { + [super touchesEnded:touches withEvent:event]; + [self setNeedsDisplay]; +} + +- (void)drawRect:(CGRect)rect { + [super drawRect:rect]; + + self.layer.borderColor = self.tintColor.CGColor; + + if (self.type == NYAlertViewButtonTypeBordered) { + self.layer.borderWidth = 1.0f; + } else { + self.layer.borderWidth = 0.0f; + } + + if (self.state == UIControlStateHighlighted) { + self.layer.backgroundColor = self.tintColor.CGColor; + // [self setTitleColor:[UIColor whiteColor] forState:UIControlStateHighlighted]; + } else { + if (self.type == NYAlertViewButtonTypeBordered) { + self.layer.backgroundColor = nil; + [self setTitleColor:self.tintColor forState:UIControlStateNormal]; + } else { + // [self setTitleColor:[UIColor whiteColor] forState:UIControlStateNormal]; + } + } +} + +@end + +@interface NYAlertView () + +@property (nonatomic) NSLayoutConstraint *alertBackgroundWidthConstraint; +@property (nonatomic) UIView *contentViewContainerView; +@property (nonatomic) UIView *textFieldContainerView; +@property (nonatomic) UIView *actionButtonContainerView; + +@end + +@implementation NYAlertView + +- (instancetype)initWithFrame:(CGRect)frame { + self = [super initWithFrame:frame]; + + if (self) { + self.maximumWidth = 480.0f; + + _alertBackgroundView = [[UIView alloc] initWithFrame:CGRectZero]; + [self.alertBackgroundView setTranslatesAutoresizingMaskIntoConstraints:NO]; + self.alertBackgroundView.backgroundColor = [UIColor colorWithWhite:0.97f alpha:1.0f]; + self.alertBackgroundView.layer.cornerRadius = 6.0f; + [self addSubview:_alertBackgroundView]; + + _titleLabel = [[UILabel alloc] initWithFrame:CGRectZero]; + [self.titleLabel setTranslatesAutoresizingMaskIntoConstraints:NO]; + self.titleLabel.numberOfLines = 2; + self.titleLabel.font = [UIFont preferredFontForTextStyle:UIFontTextStyleHeadline]; + self.titleLabel.textAlignment = NSTextAlignmentCenter; + self.titleLabel.textColor = [UIColor darkGrayColor]; + self.titleLabel.text = NSLocalizedString(@"Title Label", nil); + [self.alertBackgroundView addSubview:self.titleLabel]; + + _messageTextView = [[NYAlertTextView alloc] initWithFrame:CGRectZero]; + [self.messageTextView setTranslatesAutoresizingMaskIntoConstraints:NO]; + self.messageTextView.backgroundColor = [UIColor clearColor]; + [self.messageTextView setContentHuggingPriority:0 forAxis:UILayoutConstraintAxisVertical]; + [self.messageTextView setContentCompressionResistancePriority:UILayoutPriorityDefaultHigh forAxis:UILayoutConstraintAxisVertical]; + self.messageTextView.editable = NO; + self.messageTextView.textAlignment = NSTextAlignmentCenter; + self.messageTextView.textColor = [UIColor darkGrayColor]; + self.messageTextView.font = [UIFont preferredFontForTextStyle:UIFontTextStyleSubheadline]; + self.messageTextView.text = NSLocalizedString(@"Message Text View", nil); + [self.alertBackgroundView addSubview:self.messageTextView]; + + _contentViewContainerView = [[UIView alloc] initWithFrame:CGRectZero]; + [self.contentViewContainerView setTranslatesAutoresizingMaskIntoConstraints:NO]; + [self.contentView setContentCompressionResistancePriority:UILayoutPriorityRequired forAxis:UILayoutConstraintAxisVertical]; + [self.alertBackgroundView addSubview:self.contentViewContainerView]; + + _textFieldContainerView = [[UIView alloc] initWithFrame:CGRectZero]; + [self.textFieldContainerView setTranslatesAutoresizingMaskIntoConstraints:NO]; + [self.textFieldContainerView setContentCompressionResistancePriority:UILayoutPriorityRequired forAxis:UILayoutConstraintAxisVertical]; + [self.alertBackgroundView addSubview:self.textFieldContainerView]; + + _actionButtonContainerView = [[UIView alloc] initWithFrame:CGRectZero]; + [self.actionButtonContainerView setTranslatesAutoresizingMaskIntoConstraints:NO]; + [self.actionButtonContainerView setContentCompressionResistancePriority:UILayoutPriorityRequired forAxis:UILayoutConstraintAxisVertical]; + [self.alertBackgroundView addSubview:self.actionButtonContainerView]; + + [self addConstraint:[NSLayoutConstraint constraintWithItem:self.alertBackgroundView + attribute:NSLayoutAttributeCenterX + relatedBy:NSLayoutRelationEqual + toItem:self + attribute:NSLayoutAttributeCenterX + multiplier:1.0f + constant:0.0f]]; + + CGFloat alertBackgroundViewWidth = MIN(CGRectGetWidth([UIApplication sharedApplication].keyWindow.bounds), + CGRectGetHeight([UIApplication sharedApplication].keyWindow.bounds)) * 0.8f; + + if (alertBackgroundViewWidth > self.maximumWidth) { + alertBackgroundViewWidth = self.maximumWidth; + } + + _alertBackgroundWidthConstraint = [NSLayoutConstraint constraintWithItem:self.alertBackgroundView + attribute:NSLayoutAttributeWidth + relatedBy:NSLayoutRelationEqual + toItem:nil + attribute:NSLayoutAttributeNotAnAttribute + multiplier:0.0f + constant:alertBackgroundViewWidth]; + + [self addConstraint:self.alertBackgroundWidthConstraint]; + + _backgroundViewVerticalCenteringConstraint = [NSLayoutConstraint constraintWithItem:self.alertBackgroundView + attribute:NSLayoutAttributeCenterY + relatedBy:NSLayoutRelationEqual + toItem:self + attribute:NSLayoutAttributeCenterY + multiplier:1.0f + constant:0.0f]; + + [self addConstraint:self.backgroundViewVerticalCenteringConstraint]; + + [self addConstraint:[NSLayoutConstraint constraintWithItem:self.alertBackgroundView + attribute:NSLayoutAttributeHeight + relatedBy:NSLayoutRelationLessThanOrEqual + toItem:self + attribute:NSLayoutAttributeHeight + multiplier:0.9f + constant:0.0f]]; + + [self.alertBackgroundView addConstraints:[NSLayoutConstraint constraintsWithVisualFormat:@"H:|-[_titleLabel]-|" + options:0 + metrics:nil + views:NSDictionaryOfVariableBindings(_titleLabel)]]; + + [self.alertBackgroundView addConstraints:[NSLayoutConstraint constraintsWithVisualFormat:@"H:|-[_messageTextView]-|" + options:0 + metrics:nil + views:NSDictionaryOfVariableBindings(_messageTextView)]]; + + [self.alertBackgroundView addConstraints:[NSLayoutConstraint constraintsWithVisualFormat:@"H:|[_contentViewContainerView]|" + options:0 + metrics:nil + views:NSDictionaryOfVariableBindings(_contentViewContainerView)]]; + + [self.alertBackgroundView addConstraints:[NSLayoutConstraint constraintsWithVisualFormat:@"H:|[_textFieldContainerView]|" + options:0 + metrics:nil + views:NSDictionaryOfVariableBindings(_textFieldContainerView)]]; + + [self.alertBackgroundView addConstraints:[NSLayoutConstraint constraintsWithVisualFormat:@"H:|[_actionButtonContainerView]|" + options:0 + metrics:nil + views:NSDictionaryOfVariableBindings(_actionButtonContainerView)]]; + + [self.alertBackgroundView addConstraints:[NSLayoutConstraint constraintsWithVisualFormat:@"V:|-[_titleLabel]-2-[_messageTextView][_contentViewContainerView][_textFieldContainerView][_actionButtonContainerView]-|" + options:0 + metrics:nil + views:NSDictionaryOfVariableBindings(_titleLabel, + _messageTextView, + _contentViewContainerView, + _textFieldContainerView, + _actionButtonContainerView)]]; + } + + return self; +} + + +// Pass through touches outside the backgroundView for the presentation controller to handle dismissal +- (BOOL)pointInside:(CGPoint)point withEvent:(UIEvent *)event { + for (UIView *subview in self.subviews) { + if ([subview hitTest:[self convertPoint:point toView:subview] withEvent:event]) { + return YES; + } + } + + return NO; +} + +- (void)setMaximumWidth:(CGFloat)maximumWidth { + _maximumWidth = maximumWidth; + self.alertBackgroundWidthConstraint.constant = maximumWidth; +} + +- (void)setContentView:(UIView *)contentView { + [self.contentView removeFromSuperview]; + + _contentView = contentView; + + if (contentView) { + [self.contentView setTranslatesAutoresizingMaskIntoConstraints:NO]; + [self.contentViewContainerView addSubview:self.contentView]; + + [self.contentViewContainerView addConstraints:[NSLayoutConstraint constraintsWithVisualFormat:@"H:|[_contentView]|" + options:0 + metrics:nil + views:NSDictionaryOfVariableBindings(_contentView)]]; + + [self.contentViewContainerView addConstraints:[NSLayoutConstraint constraintsWithVisualFormat:@"V:|-2-[_contentView]-2-|" + options:0 + metrics:nil + views:NSDictionaryOfVariableBindings(_contentView)]]; + } +} + +//- (void)actionButtonPressed:(NYAlertViewButton *)button { +// NYAlertAction *action = self.actions[button.tag]; +// action.handler(action); +//} + +//- (void)setActions:(NSArray *)actions { +//// _actions = actions; +//// +// NSMutableArray *buttons = [NSMutableArray array]; +// +// // Create buttons for each action +// for (int i = 0; i < [actions count]; i++) { +// UIAlertAction *action = actions[i]; +// +// NYAlertViewButton *button = [[NYAlertViewButton alloc] initWithFrame:CGRectZero]; +// +// button.tag = i; +// [button addTarget:self action:@selector(actionButtonPressed:) forControlEvents:UIControlEventTouchUpInside]; +// +// button.cornerRadius = self.buttonCornerRadius; +// [button setTranslatesAutoresizingMaskIntoConstraints:NO]; +// [button setTitle:action.title forState:UIControlStateNormal]; +// +// if (action.style == UIAlertActionStyleCancel) { +// [button setTitleColor:self.cancelButtonTitleColor forState:UIControlStateNormal]; +// [button setTitleColor:self.cancelButtonTitleColor forState:UIControlStateHighlighted]; +// button.tintColor = self.cancelButtonColor; +// button.titleLabel.font = self.cancelButtonTitleFont; +// } else if (action.style == UIAlertActionStyleDestructive) { +// [button setTitleColor:self.destructiveButtonTitleColor forState:UIControlStateNormal]; +// [button setTitleColor:self.destructiveButtonTitleColor forState:UIControlStateHighlighted]; +// button.tintColor = self.destructiveButtonColor; +// button.titleLabel.font = self.destructiveButtonTitleFont; +// } else { +// [button setTitleColor:self.buttonTitleColor forState:UIControlStateNormal]; +// [button setTitleColor:self.buttonTitleColor forState:UIControlStateHighlighted]; +// button.tintColor = self.buttonColor; +// button.titleLabel.font = self.buttonTitleFont; +// } +// +// [buttons addObject:button]; +// } +// +// self.actionButtons = buttons; +//} + +- (void)setTextFields:(NSArray *)textFields { + for (UITextField *textField in self.textFields) { + [textField removeFromSuperview]; + } + + _textFields = textFields; + + for (int i = 0; i < [textFields count]; i++) { + UITextField *textField = textFields[i]; + [textField setTranslatesAutoresizingMaskIntoConstraints:NO]; + [self.textFieldContainerView addSubview:textField]; + + [self.textFieldContainerView addConstraints:[NSLayoutConstraint constraintsWithVisualFormat:@"H:|-[textField]-|" + options:0 + metrics:nil + views:NSDictionaryOfVariableBindings(textField)]]; + + // Pin the first text field to the top of the text field container view + if (i == 0) { + [self.textFieldContainerView addConstraints:[NSLayoutConstraint constraintsWithVisualFormat:@"V:|-[textField]" + options:0 + metrics:nil + views:NSDictionaryOfVariableBindings(_contentViewContainerView, textField)]]; + } else { + UITextField *previousTextField = textFields[i - 1]; + + [self.textFieldContainerView addConstraints:[NSLayoutConstraint constraintsWithVisualFormat:@"V:[previousTextField]-[textField]" + options:0 + metrics:nil + views:NSDictionaryOfVariableBindings(previousTextField, textField)]]; + } + + // Pin the final text field to the bottom of the text field container view + if (i == ([textFields count] - 1)) { + [self.textFieldContainerView addConstraints:[NSLayoutConstraint constraintsWithVisualFormat:@"V:[textField]|" + options:0 + metrics:nil + views:NSDictionaryOfVariableBindings(textField)]]; + } + } +} + +- (void)setActionButtons:(NSArray *)actionButtons { + for (UIButton *button in self.actionButtons) { + [button removeFromSuperview]; + } + + _actionButtons = actionButtons; + + // If there are 2 actions, display the buttons next to each other. Otherwise, stack the buttons vertically at full width + if ([actionButtons count] == 2) { + UIButton *firstButton = actionButtons[0]; + UIButton *lastButton = actionButtons[1]; + + [self.actionButtonContainerView addSubview:firstButton]; + [self.actionButtonContainerView addSubview:lastButton]; + + [self.actionButtonContainerView addConstraint:[NSLayoutConstraint constraintWithItem:firstButton + attribute:NSLayoutAttributeWidth + relatedBy:NSLayoutRelationEqual + toItem:lastButton + attribute:NSLayoutAttributeWidth + multiplier:1.0f + constant:0.0f]]; + + [self.actionButtonContainerView addConstraints:[NSLayoutConstraint constraintsWithVisualFormat:@"H:|-[firstButton]-[lastButton]-|" + options:NSLayoutFormatAlignAllCenterY + metrics:nil + views:NSDictionaryOfVariableBindings(firstButton, lastButton)]]; + + [self.actionButtonContainerView addConstraints:[NSLayoutConstraint constraintsWithVisualFormat:@"V:|-[firstButton(40)]|" + options:0 + metrics:nil + views:NSDictionaryOfVariableBindings(_contentViewContainerView, firstButton)]]; + + [self.actionButtonContainerView addConstraints:[NSLayoutConstraint constraintsWithVisualFormat:@"V:[lastButton(40)]" + options:0 + metrics:nil + views:NSDictionaryOfVariableBindings(lastButton)]]; + } else { + for (int i = 0; i < [actionButtons count]; i++) { + UIButton *actionButton = actionButtons[i]; + + [self.actionButtonContainerView addSubview:actionButton]; + + [self.actionButtonContainerView addConstraints:[NSLayoutConstraint constraintsWithVisualFormat:@"H:|-[actionButton]-|" + options:0 + metrics:nil + views:NSDictionaryOfVariableBindings(actionButton)]]; + + [self.actionButtonContainerView addConstraints:[NSLayoutConstraint constraintsWithVisualFormat:@"V:[actionButton(40)]" + options:0 + metrics:nil + views:NSDictionaryOfVariableBindings(actionButton)]]; + + if (i == 0) { + [self.actionButtonContainerView addConstraints:[NSLayoutConstraint constraintsWithVisualFormat:@"V:|-[actionButton]" + options:0 + metrics:nil + views:NSDictionaryOfVariableBindings(_contentViewContainerView, actionButton)]]; + } else { + UIButton *previousButton = actionButtons[i - 1]; + + [self.actionButtonContainerView addConstraints:[NSLayoutConstraint constraintsWithVisualFormat:@"V:[previousButton]-[actionButton]" + options:0 + metrics:nil + views:NSDictionaryOfVariableBindings(previousButton, actionButton)]]; + } + + if (i == ([actionButtons count] - 1)) { + [self.actionButtonContainerView addConstraints:[NSLayoutConstraint constraintsWithVisualFormat:@"V:[actionButton]|" + options:0 + metrics:nil + views:NSDictionaryOfVariableBindings(actionButton)]]; + } + } + } +} + +@end diff --git a/HeadsUpper/Pods/NYAlertViewController/NYAlertViewController/NYAlertViewController.h b/HeadsUpper/Pods/NYAlertViewController/NYAlertViewController/NYAlertViewController.h new file mode 100644 index 0000000..88fb990 --- /dev/null +++ b/HeadsUpper/Pods/NYAlertViewController/NYAlertViewController/NYAlertViewController.h @@ -0,0 +1,204 @@ +// +// NYAlertViewController.h +// +// Created by Nealon Young on 7/13/15. +// Copyright (c) 2015 Nealon Young. All rights reserved. +// + +#import + +@interface NYAlertAction : NSObject + ++ (instancetype)actionWithTitle:(NSString *)title style:(UIAlertActionStyle)style handler:(void (^)(NYAlertAction *action))handler; + +@property (nonatomic) NSString *title; +@property (nonatomic) UIAlertActionStyle style; +@property (nonatomic, strong) void (^handler)(NYAlertAction *action); +@property (nonatomic) BOOL enabled; + +@end + +typedef NS_ENUM(NSInteger, NYAlertViewControllerTransitionStyle) { + /** Fade in the alert view */ + NYAlertViewControllerTransitionStyleFade, + /** Slide the alert view from the top of the view */ + NYAlertViewControllerTransitionStyleSlideFromTop, + /** Slide the alert view from the bottom of the view */ + NYAlertViewControllerTransitionStyleSlideFromBottom +}; + +@interface NYAlertViewController : UIViewController + +/** + Creates an alert view controller with the specified title and message + */ ++ (instancetype)alertControllerWithTitle:(NSString *)title message:(NSString *)message; + +/** + The message displayed under the alert view's title + */ +@property (nonatomic) NSString *message; + +/** + A Boolean value that determines whether the status bar is visible when the alert view is presented + */ +@property (nonatomic) BOOL showsStatusBar; + +/** + The custom view displayed in the presented alert view + + @discussion The default value of this property is nil. Set this property to a view that you create to add the custom view to the displayed alert view. + */ +@property (nonatomic) UIView *alertViewContentView; + +/** + The transition style used to animate the alert view's presentation/dismissal transitions. + + @discussion The default value is NYAlertViewControllerTransitionStyleSlideFromTop. + */ +@property (nonatomic) NYAlertViewControllerTransitionStyle transitionStyle; + +/** + A Boolean value that determines whether the user can tap on the dimmed background surrounding the presented alert view to dismiss the alert view controller without any action handlers being executed + + @discussion The default value is NO + */ +@property (nonatomic) BOOL backgroundTapDismissalGestureEnabled; + +/** + A Boolean value that determines whether the user can swipe up or down on the presented alert view to dismiss the alert view controller without any action handlers being executed + + @discussion The default value is NO + */ +@property (nonatomic) BOOL swipeDismissalGestureEnabled; + +/** + The background color of the alert view + */ +@property (nonatomic) UIColor *alertViewBackgroundColor; + +/** + The maximum width at which to display the presented alert view + */ +@property (nonatomic) CGFloat maximumWidth; + +/** + The font used to display the title in the alert view + + @see title + */ +@property (nonatomic) UIFont *titleFont; + +/** + The font used to display the messsage in the alert view + + @see message + */ +@property (nonatomic) UIFont *messageFont; + +/** + The font used for buttons (actions with style NYAlertActionStyleDefault) in the alert view + */ +@property (nonatomic) UIFont *buttonTitleFont; + +/** + The font used for cancel buttons (actions with style NYAlertActionStyleCancel) in the alert view + */ +@property (nonatomic) UIFont *cancelButtonTitleFont; + +/** + The font used for destructive buttons (actions with style NYAlertActionStyleDestructive) in the alert view + */ +@property (nonatomic) UIFont *destructiveButtonTitleFont; + +/** + The color used to display the alert view's title + + @see title + */ +@property (nonatomic) UIColor *titleColor; + +/** + The color used to display the alert view's message + + @see message + */ +@property (nonatomic) UIColor *messageColor; + +/** + The background color for the alert view's buttons corresponsing to default style actions + */ +@property (nonatomic) UIColor *buttonColor; + +/** + The background color for the alert view's buttons corresponsing to cancel style actions + */ +@property (nonatomic) UIColor *cancelButtonColor; + +/** + The background color for the alert view's buttons corresponsing to destructive style actions + */ +@property (nonatomic) UIColor *destructiveButtonColor; + +/** + The background color for the alert view's buttons corresponsing to disabled actions + */ +@property (nonatomic) UIColor *disabledButtonColor; + +/** + The color used to display the title for buttons corresponsing to default style actions + */ +@property (nonatomic) UIColor *buttonTitleColor; + +/** + The color used to display the title for buttons corresponding to cancel style actions + */ +@property (nonatomic) UIColor *cancelButtonTitleColor; + +/** + The color used to display the title for buttons corresponsing to destructive style actions + */ +@property (nonatomic) UIColor *destructiveButtonTitleColor; + +/** + The color used to display the title for buttons corresponsing to disabled actions + */ +@property (nonatomic) UIColor *disabledButtonTitleColor; + +/** + The radius of the displayed alert view's corners + */ +@property (nonatomic) CGFloat alertViewCornerRadius; + +/** + The radius of button corners + */ +@property (nonatomic) CGFloat buttonCornerRadius; + +/** + An array of NYAlertAction objects representing the actions that the user can take in response to the alert view + */ +@property (nonatomic, readonly) NSArray *actions; + +/** + An array of UITextField objects displayed by the alert view + + @see addTextFieldWithConfigurationHandler: + */ +@property (nonatomic, readonly) NSArray *textFields; + +/** + Add an alert action object to be displayed in the alert view + + @param action The action object to display in the alert view to be presented + */ +- (void)addAction:(NYAlertAction *)action; + +/** + Add a text field object to be displayed in the alert view + + @param configurationHandler A block used to configure the text field. The block takes the text field object as a parameter, and can modify the properties of the text field prior to being displayed. + */ +- (void)addTextFieldWithConfigurationHandler:(void (^)(UITextField *textField))configurationHandler; + +@end diff --git a/HeadsUpper/Pods/NYAlertViewController/NYAlertViewController/NYAlertViewController.m b/HeadsUpper/Pods/NYAlertViewController/NYAlertViewController/NYAlertViewController.m new file mode 100644 index 0000000..7d3e8ab --- /dev/null +++ b/HeadsUpper/Pods/NYAlertViewController/NYAlertViewController/NYAlertViewController.m @@ -0,0 +1,780 @@ +// +// NYAlertViewController.m +// +// Created by Nealon Young on 7/13/15. +// Copyright (c) 2015 Nealon Young. All rights reserved. +// + +#import "NYAlertViewController.h" + +#import "NYAlertView.h" + +@interface NYAlertAction () + +@property (weak, nonatomic) UIButton *actionButton; + +@end + +@implementation NYAlertAction + ++ (instancetype)actionWithTitle:(NSString *)title style:(UIAlertActionStyle)style handler:(void (^)(NYAlertAction *action))handler { + NYAlertAction *action = [[NYAlertAction alloc] init]; + action.title = title; + action.style = style; + action.handler = handler; + + return action; +} + +- (instancetype)init { + self = [super init]; + + if (self) { + _enabled = YES; + } + + return self; +} + +- (void)setEnabled:(BOOL)enabled { + _enabled = enabled; + + self.actionButton.enabled = enabled; +} + +@end + +@interface NYAlertViewPresentationAnimationController : NSObject + +@property NYAlertViewControllerTransitionStyle transitionStyle; +@property CGFloat duration; + +@end + +static CGFloat const kDefaultPresentationAnimationDuration = 0.7f; + +@implementation NYAlertViewPresentationAnimationController + +- (instancetype)init { + self = [super init]; + + if (self) { + self.duration = kDefaultPresentationAnimationDuration; + } + + return self; +} + +- (void)animateTransition:(id)transitionContext { + if (self.transitionStyle == NYAlertViewControllerTransitionStyleSlideFromTop || self.transitionStyle == NYAlertViewControllerTransitionStyleSlideFromBottom) { + UIViewController *toViewController = [transitionContext viewControllerForKey:UITransitionContextToViewControllerKey]; + + CGRect initialFrame = [transitionContext finalFrameForViewController:toViewController]; + + initialFrame.origin.y = self.transitionStyle == NYAlertViewControllerTransitionStyleSlideFromTop ? -(initialFrame.size.height + initialFrame.origin.y) : (initialFrame.size.height + initialFrame.origin.y); + toViewController.view.frame = initialFrame; + + [[transitionContext containerView] addSubview:toViewController.view]; + + // If we're using the slide from top transition, apply a 3D rotation effect to the alert view as it animates in + if (self.transitionStyle == NYAlertViewControllerTransitionStyleSlideFromTop) { + CATransform3D transform = CATransform3DIdentity; + transform.m34 = -1.0f / 600.0f; + transform = CATransform3DRotate(transform, M_PI_4 * 1.3f, 1.0f, 0.0f, 0.0f); + + toViewController.view.layer.zPosition = 100.0f; + toViewController.view.layer.transform = transform; + } + + [UIView animateWithDuration:[self transitionDuration:transitionContext] + delay:0.0f + usingSpringWithDamping:0.76f + initialSpringVelocity:0.2f + options:0 + animations:^{ + toViewController.view.layer.transform = CATransform3DIdentity; + toViewController.view.layer.opacity = 1.0f; + toViewController.view.frame = [transitionContext finalFrameForViewController:toViewController]; + } + completion:^(BOOL finished) { + [transitionContext completeTransition:YES]; + }]; + } else { + UIViewController *toViewController = [transitionContext viewControllerForKey:UITransitionContextToViewControllerKey]; + + toViewController.view.frame = [transitionContext finalFrameForViewController:toViewController]; + [[transitionContext containerView] addSubview:toViewController.view]; + + toViewController.view.layer.transform = CATransform3DMakeScale(1.2f, 1.2f, 1.2f); + toViewController.view.layer.opacity = 0.0f; + + [UIView animateWithDuration:[self transitionDuration:transitionContext] + animations:^{ + toViewController.view.layer.transform = CATransform3DIdentity; + toViewController.view.layer.opacity = 1.0f; + } + completion:^(BOOL finished) { + [transitionContext completeTransition:YES]; + }]; + } +} + +- (NSTimeInterval)transitionDuration:(id)transitionContext { + switch (self.transitionStyle) { + case NYAlertViewControllerTransitionStyleFade: + return 0.3f; + break; + + case NYAlertViewControllerTransitionStyleSlideFromTop: + case NYAlertViewControllerTransitionStyleSlideFromBottom: + return 0.6f; + } +} + +@end + +@interface NYAlertViewDismissalAnimationController : NSObject + +@property NYAlertViewControllerTransitionStyle transitionStyle; +@property CGFloat duration; + +@end + +static CGFloat const kDefaultDismissalAnimationDuration = 0.6f; + +@implementation NYAlertViewDismissalAnimationController + +- (instancetype)init { + self = [super init]; + + if (self) { + self.duration = kDefaultDismissalAnimationDuration; + } + + return self; +} + +- (void)animateTransition:(id)transitionContext { + if (self.transitionStyle == NYAlertViewControllerTransitionStyleSlideFromTop || self.transitionStyle == NYAlertViewControllerTransitionStyleSlideFromBottom) { + UIViewController *fromViewController = [transitionContext viewControllerForKey:UITransitionContextFromViewControllerKey]; + + CGRect finalFrame = [transitionContext finalFrameForViewController:fromViewController]; + finalFrame.origin.y = 1.2f * CGRectGetHeight([transitionContext containerView].frame); + + [UIView animateWithDuration:[self transitionDuration:transitionContext] + delay:0.0f + usingSpringWithDamping:0.8f + initialSpringVelocity:0.1f + options:0 + animations:^{ + fromViewController.view.frame = finalFrame; + } + completion:^(BOOL finished) { + [transitionContext completeTransition:YES]; + }]; + } else { + UIViewController *fromViewController = [transitionContext viewControllerForKey:UITransitionContextFromViewControllerKey]; + + [UIView animateWithDuration:[self transitionDuration:transitionContext] + animations:^{ + fromViewController.view.layer.opacity = 0.0f; + } + completion:^(BOOL finished) { + [transitionContext completeTransition:YES]; + }]; + } +} + +- (NSTimeInterval)transitionDuration:(id)transitionContext { + switch (self.transitionStyle) { + case NYAlertViewControllerTransitionStyleFade: + return 0.3f; + break; + + case NYAlertViewControllerTransitionStyleSlideFromTop: + case NYAlertViewControllerTransitionStyleSlideFromBottom: + return 0.6f; + }} + +@end + +@interface NYAlertViewPresentationController : UIPresentationController + +@property CGFloat presentedViewControllerHorizontalInset; +@property CGFloat presentedViewControllerVerticalInset; +@property (nonatomic) BOOL backgroundTapDismissalGestureEnabled; +@property UIView *backgroundDimmingView; + +@end + +@interface NYAlertViewPresentationController () + +- (void)tapGestureRecognized:(UITapGestureRecognizer *)gestureRecognizer; + +@end + +@implementation NYAlertViewPresentationController + +- (void)presentationTransitionWillBegin { + self.presentedViewController.view.layer.cornerRadius = 6.0f; + self.presentedViewController.view.layer.masksToBounds = YES; + + self.backgroundDimmingView = [[UIView alloc] initWithFrame:CGRectZero]; + [self.backgroundDimmingView setTranslatesAutoresizingMaskIntoConstraints:NO]; + self.backgroundDimmingView.alpha = 0.0f; + self.backgroundDimmingView.backgroundColor = [UIColor blackColor]; + [self.containerView addSubview:self.backgroundDimmingView]; + + [self.containerView addConstraints:[NSLayoutConstraint constraintsWithVisualFormat:@"H:|[_backgroundDimmingView]|" + options:0 + metrics:nil + views:NSDictionaryOfVariableBindings(_backgroundDimmingView)]]; + + [self.containerView addConstraints:[NSLayoutConstraint constraintsWithVisualFormat:@"V:|[_backgroundDimmingView]|" + options:0 + metrics:nil + views:NSDictionaryOfVariableBindings(_backgroundDimmingView)]]; + + UITapGestureRecognizer *tapGestureRecognizer = [[UITapGestureRecognizer alloc] initWithTarget:self action:@selector(tapGestureRecognized:)]; + [self.backgroundDimmingView addGestureRecognizer:tapGestureRecognizer]; + + // Shrink the presenting view controller, and animate in the dark background view + id transitionCoordinator = [self.presentingViewController transitionCoordinator]; + [transitionCoordinator animateAlongsideTransition:^(id context) { + self.backgroundDimmingView.alpha = 0.7f; + } + completion:nil]; +} + +- (BOOL)shouldPresentInFullscreen { + return NO; +} + +- (BOOL)shouldRemovePresentersView { + return NO; +} + +- (void)presentationTransitionDidEnd:(BOOL)completed { + [super presentationTransitionDidEnd:completed]; + + if (!completed) { + [self.backgroundDimmingView removeFromSuperview]; + } +} + +- (void)dismissalTransitionWillBegin { + [super dismissalTransitionWillBegin]; + + id transitionCoordinator = [self.presentingViewController transitionCoordinator]; + [transitionCoordinator animateAlongsideTransition:^(id context) { + self.backgroundDimmingView.alpha = 0.0f; + + self.presentingViewController.view.transform = CGAffineTransformIdentity; + } + completion:nil]; +} + +- (void)containerViewWillLayoutSubviews { + [super containerViewWillLayoutSubviews]; + + [self presentedView].frame = [self frameOfPresentedViewInContainerView]; + self.backgroundDimmingView.frame = self.containerView.bounds; +} + +- (void)dismissalTransitionDidEnd:(BOOL)completed { + [super dismissalTransitionDidEnd:completed]; + + if (completed) { + [self.backgroundDimmingView removeFromSuperview]; + } +} + +- (void)tapGestureRecognized:(UITapGestureRecognizer *)gestureRecognizer { + if (self.backgroundTapDismissalGestureEnabled) { + [self.presentingViewController dismissViewControllerAnimated:YES completion:nil]; + } +} + +@end + +@interface NYAlertViewController () + +@property NYAlertView *view; +@property UIPanGestureRecognizer *panGestureRecognizer; +@property (nonatomic, strong) id transitioningDelegate; + +- (void)panGestureRecognized:(UIPanGestureRecognizer *)gestureRecognizer; + +@end + +@implementation NYAlertViewController + +@dynamic view; + ++ (instancetype)alertControllerWithTitle:(NSString *)title message:(NSString *)message { + NYAlertViewController *alertController = [[NYAlertViewController alloc] initWithNibName:nil bundle:nil]; + alertController.title = title; + alertController.message = message; + + return alertController; +} + +- (instancetype)initWithNibName:(NSString *)nibNameOrNil bundle:(NSBundle *)nibBundleOrNil { + self = [super initWithNibName:nibNameOrNil bundle:nibBundleOrNil]; + + if (self) { + [self commonInit]; + } + + return self; +} + +- (instancetype)initWithCoder:(NSCoder *)aDecoder { + self = [super initWithCoder:aDecoder]; + + if (self) { + [self commonInit]; + } + + return self; +} + +- (void)viewDidDisappear:(BOOL)animated { + // Necessary to avoid retain cycle - http://stackoverflow.com/a/21218703/1227862 + self.transitioningDelegate = nil; + [super viewDidDisappear:animated]; +} + +- (void)commonInit { + _actions = [NSArray array]; + _textFields = [NSArray array]; + + _showsStatusBar = YES; + + _buttonTitleFont = [UIFont systemFontOfSize:16.0f]; + _cancelButtonTitleFont = [UIFont boldSystemFontOfSize:16.0f]; + _destructiveButtonTitleFont = [UIFont systemFontOfSize:16.0f]; + + _buttonColor = [UIColor darkGrayColor]; + _buttonTitleColor = [UIColor whiteColor]; + _cancelButtonColor = [UIColor darkGrayColor]; + _cancelButtonTitleColor = [UIColor whiteColor]; + _destructiveButtonColor = [UIColor colorWithRed:1.0f green:0.23f blue:0.21f alpha:1.0f]; + _destructiveButtonTitleColor = [UIColor whiteColor]; + _disabledButtonColor = [UIColor lightGrayColor]; + _disabledButtonTitleColor = [UIColor whiteColor]; + + _buttonCornerRadius = 6.0f; + + _transitionStyle = NYAlertViewControllerTransitionStyleSlideFromTop; + + self.modalPresentationStyle = UIModalPresentationCustom; + self.transitioningDelegate = self; + + self.panGestureRecognizer = [[UIPanGestureRecognizer alloc] initWithTarget:self action:@selector(panGestureRecognized:)]; + self.panGestureRecognizer.delegate = self; + self.panGestureRecognizer.enabled = NO; + [self.view addGestureRecognizer:self.panGestureRecognizer]; +} + +- (void)loadView { + self.view = [[NYAlertView alloc] initWithFrame:CGRectZero]; +} + +- (BOOL)prefersStatusBarHidden { + return !self.showsStatusBar; +} + +- (CGFloat)maximumWidth { + return self.view.maximumWidth; +} + +- (void)setMaximumWidth:(CGFloat)maximumWidth { + self.view.maximumWidth = maximumWidth; +} + +- (UIView *)alertViewContentView { + return self.view.contentView; +} + +- (void)setAlertViewContentView:(UIView *)alertViewContentView { + self.view.contentView = alertViewContentView; +} + +- (void)setSwipeDismissalGestureEnabled:(BOOL)swipeDismissalGestureEnabled { + _swipeDismissalGestureEnabled = swipeDismissalGestureEnabled; + + self.panGestureRecognizer.enabled = swipeDismissalGestureEnabled; +} + +- (void)panGestureRecognized:(UIPanGestureRecognizer *)gestureRecognizer { + self.view.backgroundViewVerticalCenteringConstraint.constant = [gestureRecognizer translationInView:self.view].y; + + NYAlertViewPresentationController *presentationController = (NYAlertViewPresentationController* )self.presentationController; + + CGFloat windowHeight = CGRectGetHeight([UIApplication sharedApplication].keyWindow.bounds); + presentationController.backgroundDimmingView.alpha = 0.7f - (fabs([gestureRecognizer translationInView:self.view].y) / windowHeight); + + if (gestureRecognizer.state == UIGestureRecognizerStateEnded) { + CGFloat verticalGestureVelocity = [gestureRecognizer velocityInView:self.view].y; + + // If the gesture is moving fast enough, animate the alert view offscreen and dismiss the view controller. Otherwise, animate the alert view back to its initial position + if (fabs(verticalGestureVelocity) > 500.0f) { + CGFloat backgroundViewYPosition; + + if (verticalGestureVelocity > 500.0f) { + backgroundViewYPosition = CGRectGetHeight(self.view.frame); + } else { + backgroundViewYPosition = -CGRectGetHeight(self.view.frame); + } + + CGFloat animationDuration = 500.0f / fabs(verticalGestureVelocity); + + self.view.backgroundViewVerticalCenteringConstraint.constant = backgroundViewYPosition; + [UIView animateWithDuration:animationDuration + delay:0.0f + usingSpringWithDamping:0.8f + initialSpringVelocity:0.2f + options:0 + animations:^{ + presentationController.backgroundDimmingView.alpha = 0.0f; + [self.view layoutIfNeeded]; + } + completion:^(BOOL finished) { + [self dismissViewControllerAnimated:YES completion:nil]; + }]; + } else { + self.view.backgroundViewVerticalCenteringConstraint.constant = 0.0f; + [UIView animateWithDuration:0.5f + delay:0.0f + usingSpringWithDamping:0.8f + initialSpringVelocity:0.4f + options:0 + animations:^{ + presentationController.backgroundDimmingView.alpha = 0.7f; + [self.view layoutIfNeeded]; + } + completion:nil]; + } + } +} + +- (void)viewWillAppear:(BOOL)animated { + [super viewWillAppear:animated]; + + [self createActionButtons]; + self.view.textFields = self.textFields; +} + +- (void)setAlertViewBackgroundColor:(UIColor *)alertViewBackgroundColor { + _alertViewBackgroundColor = alertViewBackgroundColor; + + self.view.alertBackgroundView.backgroundColor = alertViewBackgroundColor; +} + +- (void)createActionButtons { + NSMutableArray *buttons = [NSMutableArray array]; + + // Create buttons for each action + for (int i = 0; i < [self.actions count]; i++) { + NYAlertAction *action = self.actions[i]; + + NYAlertViewButton *button = [NYAlertViewButton buttonWithType:UIButtonTypeCustom]; + + button.tag = i; + [button addTarget:self action:@selector(actionButtonPressed:) forControlEvents:UIControlEventTouchUpInside]; + + button.enabled = action.enabled; + + button.cornerRadius = self.buttonCornerRadius; + [button setTranslatesAutoresizingMaskIntoConstraints:NO]; + [button setTitle:action.title forState:UIControlStateNormal]; + + [button setTitleColor:self.disabledButtonTitleColor forState:UIControlStateDisabled]; + [button setBackgroundColor:self.disabledButtonColor forState:UIControlStateDisabled]; + + if (action.style == UIAlertActionStyleCancel) { + [button setTitleColor:self.cancelButtonTitleColor forState:UIControlStateNormal]; + [button setTitleColor:self.cancelButtonTitleColor forState:UIControlStateHighlighted]; + [button setBackgroundColor:self.cancelButtonColor forState:UIControlStateNormal]; + + button.titleLabel.font = self.cancelButtonTitleFont; + } else if (action.style == UIAlertActionStyleDestructive) { + [button setTitleColor:self.destructiveButtonTitleColor forState:UIControlStateNormal]; + [button setTitleColor:self.destructiveButtonTitleColor forState:UIControlStateHighlighted]; + [button setBackgroundColor:self.destructiveButtonColor forState:UIControlStateNormal]; + + button.titleLabel.font = self.destructiveButtonTitleFont; + } else { + [button setTitleColor:self.buttonTitleColor forState:UIControlStateNormal]; + [button setTitleColor:self.buttonTitleColor forState:UIControlStateHighlighted]; + [button setBackgroundColor:self.buttonColor forState:UIControlStateNormal]; + + button.titleLabel.font = self.buttonTitleFont; + } + + [buttons addObject:button]; + + action.actionButton = button; + } + + self.view.actionButtons = buttons; +} + +- (void)actionButtonPressed:(UIButton *)button { + NYAlertAction *action = self.actions[button.tag]; + action.handler(action); +} + +#pragma mark - Getters/Setters + +- (void)setTitle:(NSString *)title { + [super setTitle:title]; + + self.view.titleLabel.text = title; +} + +- (void)setMessage:(NSString *)message { + _message = message; + self.view.messageTextView.text = message; +} + +- (UIFont *)titleFont { + return self.view.titleLabel.font; +} + +- (void)setTitleFont:(UIFont *)titleFont { + self.view.titleLabel.font = titleFont; +} + +- (UIFont *)messageFont { + return self.view.messageTextView.font; +} + +- (void)setMessageFont:(UIFont *)messageFont { + self.view.messageTextView.font = messageFont; +} + +- (void)setButtonTitleFont:(UIFont *)buttonTitleFont { + _buttonTitleFont = buttonTitleFont; + + [self.view.actionButtons enumerateObjectsUsingBlock:^(UIButton *button, NSUInteger idx, BOOL *stop) { + NYAlertAction *action = self.actions[idx]; + + if (action.style != UIAlertActionStyleCancel) { + button.titleLabel.font = buttonTitleFont; + } + }]; +} + +- (void)setCancelButtonTitleFont:(UIFont *)cancelButtonTitleFont { + _cancelButtonTitleFont = cancelButtonTitleFont; + + [self.view.actionButtons enumerateObjectsUsingBlock:^(UIButton *button, NSUInteger idx, BOOL *stop) { + NYAlertAction *action = self.actions[idx]; + + if (action.style == UIAlertActionStyleCancel) { + button.titleLabel.font = cancelButtonTitleFont; + } + }]; +} + +- (void)setDestructiveButtonTitleFont:(UIFont *)destructiveButtonTitleFont { + _destructiveButtonTitleFont = destructiveButtonTitleFont; + + [self.view.actionButtons enumerateObjectsUsingBlock:^(UIButton *button, NSUInteger idx, BOOL *stop) { + NYAlertAction *action = self.actions[idx]; + + if (action.style == UIAlertActionStyleDestructive) { + button.titleLabel.font = destructiveButtonTitleFont; + } + }]; +} + +- (UIColor *)titleColor { + return self.view.titleLabel.textColor; +} + +- (void)setTitleColor:(UIColor *)titleColor { + self.view.titleLabel.textColor = titleColor; +} + +- (UIColor *)messageColor { + return self.view.messageTextView.textColor; +} + +- (void)setMessageColor:(UIColor *)messageColor { + self.view.messageTextView.textColor = messageColor; +} + +- (void)setButtonColor:(UIColor *)buttonColor { + _buttonColor = buttonColor; + + [self.view.actionButtons enumerateObjectsUsingBlock:^(UIButton *button, NSUInteger idx, BOOL *stop) { + NYAlertAction *action = self.actions[idx]; + + if (action.style != UIAlertActionStyleCancel) { + [button setBackgroundColor:buttonColor forState:UIControlStateNormal]; + } + }]; +} + +- (void)setCancelButtonColor:(UIColor *)cancelButtonColor { + _cancelButtonColor = cancelButtonColor; + + [self.view.actionButtons enumerateObjectsUsingBlock:^(UIButton *button, NSUInteger idx, BOOL *stop) { + NYAlertAction *action = self.actions[idx]; + + if (action.style == UIAlertActionStyleCancel) { + [button setBackgroundColor:cancelButtonColor forState:UIControlStateNormal]; + } + }]; +} + +- (void)setDestructiveButtonColor:(UIColor *)destructiveButtonColor { + _destructiveButtonColor = destructiveButtonColor; + + [self.view.actionButtons enumerateObjectsUsingBlock:^(UIButton *button, NSUInteger idx, BOOL *stop) { + NYAlertAction *action = self.actions[idx]; + + if (action.style == UIAlertActionStyleDestructive) { + [button setBackgroundColor:destructiveButtonColor forState:UIControlStateNormal]; + } + }]; +} + +- (void)setDisabledButtonColor:(UIColor *)disabledButtonColor { + _disabledButtonColor = disabledButtonColor; + + [self.view.actionButtons enumerateObjectsUsingBlock:^(UIButton *button, NSUInteger idx, BOOL *stop) { + NYAlertAction *action = self.actions[idx]; + + if (!action.enabled) { + [button setBackgroundColor:disabledButtonColor forState:UIControlStateNormal]; + } + }]; +} + +- (void)setButtonTitleColor:(UIColor *)buttonTitleColor { + _buttonTitleColor = buttonTitleColor; + + [self.view.actionButtons enumerateObjectsUsingBlock:^(UIButton *button, NSUInteger idx, BOOL *stop) { + NYAlertAction *action = self.actions[idx]; + + if (action.style != UIAlertActionStyleCancel) { + [button setTitleColor:buttonTitleColor forState:UIControlStateNormal]; + [button setTitleColor:buttonTitleColor forState:UIControlStateHighlighted]; + } + }]; +} + +- (void)setCancelButtonTitleColor:(UIColor *)cancelButtonTitleColor { + _cancelButtonTitleColor = cancelButtonTitleColor; + + [self.view.actionButtons enumerateObjectsUsingBlock:^(UIButton *button, NSUInteger idx, BOOL *stop) { + NYAlertAction *action = self.actions[idx]; + + if (action.style == UIAlertActionStyleCancel) { + [button setTitleColor:cancelButtonTitleColor forState:UIControlStateNormal]; + [button setTitleColor:cancelButtonTitleColor forState:UIControlStateHighlighted]; + } + }]; +} + +- (void)setDestructiveButtonTitleColor:(UIColor *)destructiveButtonTitleColor { + _destructiveButtonTitleColor = destructiveButtonTitleColor; + + [self.view.actionButtons enumerateObjectsUsingBlock:^(UIButton *button, NSUInteger idx, BOOL *stop) { + NYAlertAction *action = self.actions[idx]; + + if (action.style == UIAlertActionStyleDestructive) { + [button setTitleColor:destructiveButtonTitleColor forState:UIControlStateNormal]; + [button setTitleColor:destructiveButtonTitleColor forState:UIControlStateHighlighted]; + } + }]; +} + +- (void)setDisabledButtonTitleColor:(UIColor *)disabledButtonTitleColor { + _disabledButtonTitleColor = disabledButtonTitleColor; + + [self.view.actionButtons enumerateObjectsUsingBlock:^(UIButton *button, NSUInteger idx, BOOL *stop) { + NYAlertAction *action = self.actions[idx]; + + if (!action.enabled) { + [button setTitleColor:disabledButtonTitleColor forState:UIControlStateNormal]; + [button setTitleColor:disabledButtonTitleColor forState:UIControlStateHighlighted]; + } + }]; +} + +- (CGFloat)alertViewCornerRadius { + return self.view.alertBackgroundView.layer.cornerRadius; +} + +- (void)setAlertViewCornerRadius:(CGFloat)alertViewCornerRadius { + self.view.alertBackgroundView.layer.cornerRadius = alertViewCornerRadius; +} + +- (void)setButtonCornerRadius:(CGFloat)buttonCornerRadius { + _buttonCornerRadius = buttonCornerRadius; + + for (NYAlertViewButton *button in self.view.actionButtons) { + button.cornerRadius = buttonCornerRadius; + } +} + +- (void)addAction:(UIAlertAction *)action { + _actions = [self.actions arrayByAddingObject:action]; +} + +- (void)addTextFieldWithConfigurationHandler:(void (^)(UITextField *textField))configurationHandler { + UITextField *textField = [[UITextField alloc] initWithFrame:CGRectZero]; + textField.borderStyle = UITextBorderStyleRoundedRect; + + configurationHandler(textField); + + _textFields = [self.textFields arrayByAddingObject:textField]; +} + +- (void)buttonPressed:(UIButton *)sender { + NYAlertAction *action = self.actions[sender.tag]; + action.handler(action); +} + +#pragma mark - UIViewControllerTransitioningDelegate + +- (UIPresentationController *)presentationControllerForPresentedViewController:(UIViewController *)presented + presentingViewController:(UIViewController *)presenting + sourceViewController:(UIViewController *)source { + NYAlertViewPresentationController *presentationController = [[NYAlertViewPresentationController alloc] initWithPresentedViewController:presented + presentingViewController:presenting]; + presentationController.backgroundTapDismissalGestureEnabled = self.backgroundTapDismissalGestureEnabled; + return presentationController; +} + +- (id )animationControllerForPresentedController:(UIViewController *)presented + presentingController:(UIViewController *)presenting + sourceController:(UIViewController *)source { + NYAlertViewPresentationAnimationController *presentationAnimationController = [[NYAlertViewPresentationAnimationController alloc] init]; + presentationAnimationController.transitionStyle = self.transitionStyle; + return presentationAnimationController; +} + +- (id )animationControllerForDismissedController:(UIViewController *)dismissed { + NYAlertViewDismissalAnimationController *dismissalAnimationController = [[NYAlertViewDismissalAnimationController alloc] init]; + dismissalAnimationController.transitionStyle = self.transitionStyle; + return dismissalAnimationController; +} + +#pragma mark - UIGestureRecognizerDelegate + +- (BOOL)gestureRecognizer:(UIGestureRecognizer *)gestureRecognizer shouldReceiveTouch:(UITouch *)touch { + // Don't recognize the pan gesture in the button, so users can move their finger away after touching down + if (([touch.view isKindOfClass:[UIButton class]])) { + return NO; + } + + return YES; +} + +@end diff --git a/HeadsUpper/Pods/NYAlertViewController/README.md b/HeadsUpper/Pods/NYAlertViewController/README.md new file mode 100644 index 0000000..a842583 --- /dev/null +++ b/HeadsUpper/Pods/NYAlertViewController/README.md @@ -0,0 +1,104 @@ +# NYAlertViewController + +NYAlertViewController is a replacement for UIAlertController/UIAlertView with support for content views and UI customization. + +![Example](https://github.com/nealyoung/NYAlertViewController/raw/master/header.png) + +### Features +* Includes content view property for adding custom views to the alert view +* Block-based API similar to UIAlertController/UIAlertAction +* Support for all screen orientations and iPad screen sizes +* Easily add text fields with simple API identical to UIAlertController +* Choose between fade (similar to UIAlertController) or slide transition animations + +### Installation +#### Manual +Add the files to your project manually by dragging the NYAlertViewController directory into your Xcode project. + +#### CocoaPods +Add `pod 'NYAlertViewController'` to your Podfile, and run `pod install`. + +### Usage Examples +An Objectve-C example project demonstrating customization options is included in the NYAlertViewControllerDemo directory. + +#### Objective-C + +```objc +// Import the class and create an NYAlertViewController instance +#import "NYAlertViewController.h" + +// ... + +NYAlertViewController *alertViewController = [[NYAlertViewController alloc] initWithNibName:nil bundle:nil]; + +// Set a title and message +alertViewController.title = NSLocalizedString(@"Custom UI", nil); +alertViewController.message = NSLocalizedString(@"Integer posuere erat a ante venenatis dapibus posuere velit aliquet. Donec id elit non mi porta gravida at eget metus.", nil); + +// Customize appearance as desired +alertViewController.buttonCornerRadius = 20.0f; +alertViewController.view.tintColor = self.view.tintColor; + +alertViewController.titleFont = [UIFont fontWithName:@"AvenirNext-Bold" size:19.0f]; +alertViewController.messageFont = [UIFont fontWithName:@"AvenirNext-Medium" size:16.0f]; +alertViewController.buttonTitleFont = [UIFont fontWithName:@"AvenirNext-Regular" size:alertViewController.buttonTitleFont.pointSize]; +alertViewController.cancelButtonTitleFont = [UIFont fontWithName:@"AvenirNext-Medium" size:alertViewController.cancelButtonTitleFont.pointSize]; + +alertViewController.swipeDismissalGestureEnabled = YES: +alertViewController.backgroundTapDismissalGestureEnabled = YES: + +// Add alert actions +[alertViewController addAction:[NYAlertAction actionWithTitle:NSLocalizedString(@"Done", nil) + style:UIAlertActionStyleCancel + handler:^(NYAlertAction *action) { + [self dismissViewControllerAnimated:YES completion:nil]; + }]]; + +// Present the alert view controller +[self presentViewController:alertViewController animated:YES]; +``` + +#### Swift + +```swift +import NYAlertViewController + +// ... + +let alertViewController = NYAlertViewController() + +// Set a title and message +alertViewController.title = "Custom UI" +alertViewController.message = "Integer posuere erat a ante venenatis dapibus posuere velit aliquet. Donec id elit non mi porta gravida at eget metus." + +// Customize appearance as desired +alertViewController.buttonCornerRadius = 20.0 +alertViewController.view.tintColor = self.view.tintColor + +alertViewController.titleFont = UIFont(name: "AvenirNext-Bold", size: 19.0) +alertViewController.messageFont = UIFont(name: "AvenirNext-Medium", size: 16.0) +alertViewController.cancelButtonTitleFont = UIFont(name: "AvenirNext-Medium", size: 16.0) +alertViewController.cancelButtonTitleFont = UIFont(name: "AvenirNext-Medium", size: 16.0) + +alertViewController.swipeDismissalGestureEnabled = true +alertViewController.backgroundTapDismissalGestureEnabled = true + +// Add alert actions +let cancelAction = NYAlertAction( + title: "Done", + style: .Cancel, + handler: { (action: NYAlertAction!) -> Void in + self.dismissViewControllerAnimated(true, completion: nil) + } +) +alertViewController.addAction(cancelAction) + +// Present the alert view controller +self.presentViewController(alertViewController, animated: true, completion: nil) +``` + +### To-Dos +* Add different transition options (fade in, slide from top, etc.) + +### License +This project is released under the MIT License. diff --git a/HeadsUpper/Pods/Pods.xcodeproj/project.pbxproj b/HeadsUpper/Pods/Pods.xcodeproj/project.pbxproj new file mode 100644 index 0000000..d78adfe --- /dev/null +++ b/HeadsUpper/Pods/Pods.xcodeproj/project.pbxproj @@ -0,0 +1,438 @@ +// !$*UTF8*$! +{ + archiveVersion = 1; + classes = { + }; + objectVersion = 46; + objects = { + +/* Begin PBXBuildFile section */ + 07CBCC11DBA4861F44834B076F1C6CDE /* NYAlertView.h in Headers */ = {isa = PBXBuildFile; fileRef = 334588C5690F4C17DEB8E883991B9D9F /* NYAlertView.h */; }; + 111879974CDC08733197977EB3B94AC1 /* NYAlertViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = 4799FE9DB46234FB077430EF6556A8E6 /* NYAlertViewController.m */; }; + 3228E54F5B35961E6A0FA005659824D9 /* NYAlertViewController-dummy.m in Sources */ = {isa = PBXBuildFile; fileRef = 3B95DC3C8DB2A0CEAE17276CB7656B31 /* NYAlertViewController-dummy.m */; }; + 37351571B0101E594C3E6C3F79BA59D4 /* NYAlertViewController.h in Headers */ = {isa = PBXBuildFile; fileRef = 21FEA5A1C59A4D8D7493414AB167BBF4 /* NYAlertViewController.h */; }; + 65BC020F385D8498E11AEECF0BF63B8B /* Foundation.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 4DEFA8C7E3C02D1C717DC31261973DF0 /* Foundation.framework */; }; + A5863C425615390B3882C5D40D8D6C26 /* Pods-dummy.m in Sources */ = {isa = PBXBuildFile; fileRef = 2B6F93620988975524AE8FB0DE25F060 /* Pods-dummy.m */; }; + B21FD7CDC0E258E9D7F2B61AA7E863B4 /* Foundation.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 4DEFA8C7E3C02D1C717DC31261973DF0 /* Foundation.framework */; }; + D4C30072F8120F6AC233D9CE1D3008B3 /* NYAlertView.m in Sources */ = {isa = PBXBuildFile; fileRef = CF082A328ACA03A1B8BBE5B444D7C156 /* NYAlertView.m */; }; +/* End PBXBuildFile section */ + +/* Begin PBXContainerItemProxy section */ + 0DC195222F8B1144352900DDF4A3FA9B /* PBXContainerItemProxy */ = { + isa = PBXContainerItemProxy; + containerPortal = D41D8CD98F00B204E9800998ECF8427E /* Project object */; + proxyType = 1; + remoteGlobalIDString = 7DCA38AE61FA70D0EC0BA2BF488AE3F8; + remoteInfo = NYAlertViewController; + }; +/* End PBXContainerItemProxy section */ + +/* Begin PBXFileReference section */ + 1190F2410DBEC38C88D7B26AC3B44654 /* Pods.release.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; path = Pods.release.xcconfig; sourceTree = ""; }; + 15A529C27057E4A57D259CBC6E6CE49C /* Pods-acknowledgements.markdown */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text; path = "Pods-acknowledgements.markdown"; sourceTree = ""; }; + 21FEA5A1C59A4D8D7493414AB167BBF4 /* NYAlertViewController.h */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.h; name = NYAlertViewController.h; path = NYAlertViewController/NYAlertViewController.h; sourceTree = ""; }; + 2B6F93620988975524AE8FB0DE25F060 /* Pods-dummy.m */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.objc; path = "Pods-dummy.m"; sourceTree = ""; }; + 2C422E354B0632967ECD07DBB6C89249 /* NYAlertViewController-Private.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; path = "NYAlertViewController-Private.xcconfig"; sourceTree = ""; }; + 334588C5690F4C17DEB8E883991B9D9F /* NYAlertView.h */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.h; name = NYAlertView.h; path = NYAlertViewController/NYAlertView.h; sourceTree = ""; }; + 3B95DC3C8DB2A0CEAE17276CB7656B31 /* NYAlertViewController-dummy.m */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.objc; path = "NYAlertViewController-dummy.m"; sourceTree = ""; }; + 4799FE9DB46234FB077430EF6556A8E6 /* NYAlertViewController.m */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.objc; name = NYAlertViewController.m; path = NYAlertViewController/NYAlertViewController.m; sourceTree = ""; }; + 4DEFA8C7E3C02D1C717DC31261973DF0 /* Foundation.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = Foundation.framework; path = Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS8.3.sdk/System/Library/Frameworks/Foundation.framework; sourceTree = DEVELOPER_DIR; }; + 641AE05DD55E5E6AC1590CD7B4A18F97 /* Pods-resources.sh */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.script.sh; path = "Pods-resources.sh"; sourceTree = ""; }; + 7E086E25E27061E99E08B590B46F14B4 /* NYAlertViewController.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; path = NYAlertViewController.xcconfig; sourceTree = ""; }; + 90F8FB11ABAB6B30661151CF06CDE7A9 /* libPods.a */ = {isa = PBXFileReference; explicitFileType = archive.ar; includeInIndex = 0; path = libPods.a; sourceTree = BUILT_PRODUCTS_DIR; }; + 9857054B2745038392B4473FE84E1D4C /* Pods.debug.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; path = Pods.debug.xcconfig; sourceTree = ""; }; + BA6428E9F66FD5A23C0A2E06ED26CD2F /* Podfile */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text; name = Podfile; path = ../Podfile; sourceTree = SOURCE_ROOT; xcLanguageSpecificationIdentifier = xcode.lang.ruby; }; + BF59BC15D23E1E1912C8F334E7236813 /* Pods-acknowledgements.plist */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.plist.xml; path = "Pods-acknowledgements.plist"; sourceTree = ""; }; + CF082A328ACA03A1B8BBE5B444D7C156 /* NYAlertView.m */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.objc; name = NYAlertView.m; path = NYAlertViewController/NYAlertView.m; sourceTree = ""; }; + D58BEED873A6F656757D89CE0B615251 /* libNYAlertViewController.a */ = {isa = PBXFileReference; explicitFileType = archive.ar; includeInIndex = 0; path = libNYAlertViewController.a; sourceTree = BUILT_PRODUCTS_DIR; }; + EDB68263202A41EE7E3A6B7E4AA165ED /* NYAlertViewController-prefix.pch */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.h; path = "NYAlertViewController-prefix.pch"; sourceTree = ""; }; +/* End PBXFileReference section */ + +/* Begin PBXFrameworksBuildPhase section */ + 97A0744494320DB1975E55EBBEBA8CE6 /* Frameworks */ = { + isa = PBXFrameworksBuildPhase; + buildActionMask = 2147483647; + files = ( + B21FD7CDC0E258E9D7F2B61AA7E863B4 /* Foundation.framework in Frameworks */, + ); + runOnlyForDeploymentPostprocessing = 0; + }; + FA99A204B7739AC751A13113E05762AA /* Frameworks */ = { + isa = PBXFrameworksBuildPhase; + buildActionMask = 2147483647; + files = ( + 65BC020F385D8498E11AEECF0BF63B8B /* Foundation.framework in Frameworks */, + ); + runOnlyForDeploymentPostprocessing = 0; + }; +/* End PBXFrameworksBuildPhase section */ + +/* Begin PBXGroup section */ + 4CDD6E44625B639AF9EAC930704475AA /* Support Files */ = { + isa = PBXGroup; + children = ( + 7E086E25E27061E99E08B590B46F14B4 /* NYAlertViewController.xcconfig */, + 2C422E354B0632967ECD07DBB6C89249 /* NYAlertViewController-Private.xcconfig */, + 3B95DC3C8DB2A0CEAE17276CB7656B31 /* NYAlertViewController-dummy.m */, + EDB68263202A41EE7E3A6B7E4AA165ED /* NYAlertViewController-prefix.pch */, + ); + name = "Support Files"; + path = "../Target Support Files/NYAlertViewController"; + sourceTree = ""; + }; + 53F661C0CA7190D2CF05023FB33D61E4 /* iOS */ = { + isa = PBXGroup; + children = ( + 4DEFA8C7E3C02D1C717DC31261973DF0 /* Foundation.framework */, + ); + name = iOS; + sourceTree = ""; + }; + 5A7F924B6195375D7533DECEAA6CD53C /* NYAlertViewController */ = { + isa = PBXGroup; + children = ( + 334588C5690F4C17DEB8E883991B9D9F /* NYAlertView.h */, + CF082A328ACA03A1B8BBE5B444D7C156 /* NYAlertView.m */, + 21FEA5A1C59A4D8D7493414AB167BBF4 /* NYAlertViewController.h */, + 4799FE9DB46234FB077430EF6556A8E6 /* NYAlertViewController.m */, + 4CDD6E44625B639AF9EAC930704475AA /* Support Files */, + ); + path = NYAlertViewController; + sourceTree = ""; + }; + 7DB346D0F39D3F0E887471402A8071AB = { + isa = PBXGroup; + children = ( + BA6428E9F66FD5A23C0A2E06ED26CD2F /* Podfile */, + BC3CA7F9E30CC8F7E2DD044DD34432FC /* Frameworks */, + AA23948700E86252889E082027F7B898 /* Pods */, + CCA510CFBEA2D207524CDA0D73C3B561 /* Products */, + D2411A5FE7F7A004607BED49990C37F4 /* Targets Support Files */, + ); + sourceTree = ""; + }; + 952EEBFAF8F7E620423C9F156F25A506 /* Pods */ = { + isa = PBXGroup; + children = ( + 15A529C27057E4A57D259CBC6E6CE49C /* Pods-acknowledgements.markdown */, + BF59BC15D23E1E1912C8F334E7236813 /* Pods-acknowledgements.plist */, + 2B6F93620988975524AE8FB0DE25F060 /* Pods-dummy.m */, + 641AE05DD55E5E6AC1590CD7B4A18F97 /* Pods-resources.sh */, + 9857054B2745038392B4473FE84E1D4C /* Pods.debug.xcconfig */, + 1190F2410DBEC38C88D7B26AC3B44654 /* Pods.release.xcconfig */, + ); + name = Pods; + path = "Target Support Files/Pods"; + sourceTree = ""; + }; + AA23948700E86252889E082027F7B898 /* Pods */ = { + isa = PBXGroup; + children = ( + 5A7F924B6195375D7533DECEAA6CD53C /* NYAlertViewController */, + ); + name = Pods; + sourceTree = ""; + }; + BC3CA7F9E30CC8F7E2DD044DD34432FC /* Frameworks */ = { + isa = PBXGroup; + children = ( + 53F661C0CA7190D2CF05023FB33D61E4 /* iOS */, + ); + name = Frameworks; + sourceTree = ""; + }; + CCA510CFBEA2D207524CDA0D73C3B561 /* Products */ = { + isa = PBXGroup; + children = ( + D58BEED873A6F656757D89CE0B615251 /* libNYAlertViewController.a */, + 90F8FB11ABAB6B30661151CF06CDE7A9 /* libPods.a */, + ); + name = Products; + sourceTree = ""; + }; + D2411A5FE7F7A004607BED49990C37F4 /* Targets Support Files */ = { + isa = PBXGroup; + children = ( + 952EEBFAF8F7E620423C9F156F25A506 /* Pods */, + ); + name = "Targets Support Files"; + sourceTree = ""; + }; +/* End PBXGroup section */ + +/* Begin PBXHeadersBuildPhase section */ + E0F70E2C4DF80A15C50E24AC1A1F4216 /* Headers */ = { + isa = PBXHeadersBuildPhase; + buildActionMask = 2147483647; + files = ( + 07CBCC11DBA4861F44834B076F1C6CDE /* NYAlertView.h in Headers */, + 37351571B0101E594C3E6C3F79BA59D4 /* NYAlertViewController.h in Headers */, + ); + runOnlyForDeploymentPostprocessing = 0; + }; +/* End PBXHeadersBuildPhase section */ + +/* Begin PBXNativeTarget section */ + 48CBEC1BD7F2885571A2C32D4C43A063 /* Pods */ = { + isa = PBXNativeTarget; + buildConfigurationList = BBC03AB7103FAC54FA19B4A96689F639 /* Build configuration list for PBXNativeTarget "Pods" */; + buildPhases = ( + A7B9A83BB455A00A0DA5E7D76CA4DE59 /* Sources */, + 97A0744494320DB1975E55EBBEBA8CE6 /* Frameworks */, + ); + buildRules = ( + ); + dependencies = ( + 5760A931F7B334DEF692983D83480341 /* PBXTargetDependency */, + ); + name = Pods; + productName = Pods; + productReference = 90F8FB11ABAB6B30661151CF06CDE7A9 /* libPods.a */; + productType = "com.apple.product-type.library.static"; + }; + 7DCA38AE61FA70D0EC0BA2BF488AE3F8 /* NYAlertViewController */ = { + isa = PBXNativeTarget; + buildConfigurationList = B9484451F110695C9C7315992FC1B452 /* Build configuration list for PBXNativeTarget "NYAlertViewController" */; + buildPhases = ( + 15A6CDB9F850A181A81ABA2FF2349375 /* Sources */, + FA99A204B7739AC751A13113E05762AA /* Frameworks */, + E0F70E2C4DF80A15C50E24AC1A1F4216 /* Headers */, + ); + buildRules = ( + ); + dependencies = ( + ); + name = NYAlertViewController; + productName = NYAlertViewController; + productReference = D58BEED873A6F656757D89CE0B615251 /* libNYAlertViewController.a */; + productType = "com.apple.product-type.library.static"; + }; +/* End PBXNativeTarget section */ + +/* Begin PBXProject section */ + D41D8CD98F00B204E9800998ECF8427E /* Project object */ = { + isa = PBXProject; + attributes = { + LastSwiftUpdateCheck = 0700; + LastUpgradeCheck = 0700; + }; + buildConfigurationList = 2D8E8EC45A3A1A1D94AE762CB5028504 /* Build configuration list for PBXProject "Pods" */; + compatibilityVersion = "Xcode 3.2"; + developmentRegion = English; + hasScannedForEncodings = 0; + knownRegions = ( + en, + ); + mainGroup = 7DB346D0F39D3F0E887471402A8071AB; + productRefGroup = CCA510CFBEA2D207524CDA0D73C3B561 /* Products */; + projectDirPath = ""; + projectRoot = ""; + targets = ( + 7DCA38AE61FA70D0EC0BA2BF488AE3F8 /* NYAlertViewController */, + 48CBEC1BD7F2885571A2C32D4C43A063 /* Pods */, + ); + }; +/* End PBXProject section */ + +/* Begin PBXSourcesBuildPhase section */ + 15A6CDB9F850A181A81ABA2FF2349375 /* Sources */ = { + isa = PBXSourcesBuildPhase; + buildActionMask = 2147483647; + files = ( + D4C30072F8120F6AC233D9CE1D3008B3 /* NYAlertView.m in Sources */, + 3228E54F5B35961E6A0FA005659824D9 /* NYAlertViewController-dummy.m in Sources */, + 111879974CDC08733197977EB3B94AC1 /* NYAlertViewController.m in Sources */, + ); + runOnlyForDeploymentPostprocessing = 0; + }; + A7B9A83BB455A00A0DA5E7D76CA4DE59 /* Sources */ = { + isa = PBXSourcesBuildPhase; + buildActionMask = 2147483647; + files = ( + A5863C425615390B3882C5D40D8D6C26 /* Pods-dummy.m in Sources */, + ); + runOnlyForDeploymentPostprocessing = 0; + }; +/* End PBXSourcesBuildPhase section */ + +/* Begin PBXTargetDependency section */ + 5760A931F7B334DEF692983D83480341 /* PBXTargetDependency */ = { + isa = PBXTargetDependency; + name = NYAlertViewController; + target = 7DCA38AE61FA70D0EC0BA2BF488AE3F8 /* NYAlertViewController */; + targetProxy = 0DC195222F8B1144352900DDF4A3FA9B /* PBXContainerItemProxy */; + }; +/* End PBXTargetDependency section */ + +/* Begin XCBuildConfiguration section */ + 20700B540BEC6E0FD549D756429D96D5 /* Debug */ = { + isa = XCBuildConfiguration; + baseConfigurationReference = 2C422E354B0632967ECD07DBB6C89249 /* NYAlertViewController-Private.xcconfig */; + buildSettings = { + ENABLE_STRICT_OBJC_MSGSEND = YES; + GCC_PREFIX_HEADER = "Target Support Files/NYAlertViewController/NYAlertViewController-prefix.pch"; + IPHONEOS_DEPLOYMENT_TARGET = 9.2; + MTL_ENABLE_DEBUG_INFO = YES; + OTHER_LDFLAGS = ""; + OTHER_LIBTOOLFLAGS = ""; + PRODUCT_NAME = "$(TARGET_NAME)"; + SDKROOT = iphoneos; + SKIP_INSTALL = YES; + }; + name = Debug; + }; + 223FD3CE64284CEBE1D80C4FF66EA2CD /* Release */ = { + isa = XCBuildConfiguration; + baseConfigurationReference = 1190F2410DBEC38C88D7B26AC3B44654 /* Pods.release.xcconfig */; + buildSettings = { + ENABLE_STRICT_OBJC_MSGSEND = YES; + IPHONEOS_DEPLOYMENT_TARGET = 9.2; + MTL_ENABLE_DEBUG_INFO = NO; + OTHER_LDFLAGS = ""; + OTHER_LIBTOOLFLAGS = ""; + PODS_ROOT = "$(SRCROOT)"; + PRODUCT_NAME = "$(TARGET_NAME)"; + SDKROOT = iphoneos; + SKIP_INSTALL = YES; + }; + name = Release; + }; + 8D1534490D941DCA47C62AC4314182AF /* Debug */ = { + isa = XCBuildConfiguration; + buildSettings = { + ALWAYS_SEARCH_USER_PATHS = NO; + CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x"; + CLANG_CXX_LIBRARY = "libc++"; + CLANG_ENABLE_MODULES = YES; + CLANG_ENABLE_OBJC_ARC = YES; + CLANG_WARN_BOOL_CONVERSION = YES; + CLANG_WARN_CONSTANT_CONVERSION = YES; + CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES; + CLANG_WARN_EMPTY_BODY = YES; + CLANG_WARN_ENUM_CONVERSION = YES; + CLANG_WARN_INT_CONVERSION = YES; + CLANG_WARN_OBJC_ROOT_CLASS = YES; + CLANG_WARN_UNREACHABLE_CODE = YES; + CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; + COPY_PHASE_STRIP = NO; + GCC_C_LANGUAGE_STANDARD = gnu99; + GCC_DYNAMIC_NO_PIC = NO; + GCC_OPTIMIZATION_LEVEL = 0; + GCC_PREPROCESSOR_DEFINITIONS = ( + "DEBUG=1", + "$(inherited)", + ); + GCC_SYMBOLS_PRIVATE_EXTERN = NO; + GCC_WARN_64_TO_32_BIT_CONVERSION = YES; + GCC_WARN_ABOUT_RETURN_TYPE = YES; + GCC_WARN_UNDECLARED_SELECTOR = YES; + GCC_WARN_UNINITIALIZED_AUTOS = YES; + GCC_WARN_UNUSED_FUNCTION = YES; + GCC_WARN_UNUSED_VARIABLE = YES; + IPHONEOS_DEPLOYMENT_TARGET = 9.2; + ONLY_ACTIVE_ARCH = YES; + STRIP_INSTALLED_PRODUCT = NO; + SYMROOT = "${SRCROOT}/../build"; + }; + name = Debug; + }; + A4F9399B13A7DC99BD06B8A108DEC2FC /* Release */ = { + isa = XCBuildConfiguration; + baseConfigurationReference = 2C422E354B0632967ECD07DBB6C89249 /* NYAlertViewController-Private.xcconfig */; + buildSettings = { + ENABLE_STRICT_OBJC_MSGSEND = YES; + GCC_PREFIX_HEADER = "Target Support Files/NYAlertViewController/NYAlertViewController-prefix.pch"; + IPHONEOS_DEPLOYMENT_TARGET = 9.2; + MTL_ENABLE_DEBUG_INFO = NO; + OTHER_LDFLAGS = ""; + OTHER_LIBTOOLFLAGS = ""; + PRODUCT_NAME = "$(TARGET_NAME)"; + SDKROOT = iphoneos; + SKIP_INSTALL = YES; + }; + name = Release; + }; + C5A18280E9321A9268D1C80B7DA43967 /* Release */ = { + isa = XCBuildConfiguration; + buildSettings = { + ALWAYS_SEARCH_USER_PATHS = NO; + CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x"; + CLANG_CXX_LIBRARY = "libc++"; + CLANG_ENABLE_MODULES = YES; + CLANG_ENABLE_OBJC_ARC = YES; + CLANG_WARN_BOOL_CONVERSION = YES; + CLANG_WARN_CONSTANT_CONVERSION = YES; + CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES; + CLANG_WARN_EMPTY_BODY = YES; + CLANG_WARN_ENUM_CONVERSION = YES; + CLANG_WARN_INT_CONVERSION = YES; + CLANG_WARN_OBJC_ROOT_CLASS = YES; + CLANG_WARN_UNREACHABLE_CODE = YES; + CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; + COPY_PHASE_STRIP = YES; + ENABLE_NS_ASSERTIONS = NO; + GCC_C_LANGUAGE_STANDARD = gnu99; + GCC_PREPROCESSOR_DEFINITIONS = "RELEASE=1"; + GCC_WARN_64_TO_32_BIT_CONVERSION = YES; + GCC_WARN_ABOUT_RETURN_TYPE = YES; + GCC_WARN_UNDECLARED_SELECTOR = YES; + GCC_WARN_UNINITIALIZED_AUTOS = YES; + GCC_WARN_UNUSED_FUNCTION = YES; + GCC_WARN_UNUSED_VARIABLE = YES; + IPHONEOS_DEPLOYMENT_TARGET = 9.2; + STRIP_INSTALLED_PRODUCT = NO; + SYMROOT = "${SRCROOT}/../build"; + VALIDATE_PRODUCT = YES; + }; + name = Release; + }; + FDFC2AB58C0E5F01A9E1214D90203CFD /* Debug */ = { + isa = XCBuildConfiguration; + baseConfigurationReference = 9857054B2745038392B4473FE84E1D4C /* Pods.debug.xcconfig */; + buildSettings = { + ENABLE_STRICT_OBJC_MSGSEND = YES; + IPHONEOS_DEPLOYMENT_TARGET = 9.2; + MTL_ENABLE_DEBUG_INFO = YES; + OTHER_LDFLAGS = ""; + OTHER_LIBTOOLFLAGS = ""; + PODS_ROOT = "$(SRCROOT)"; + PRODUCT_NAME = "$(TARGET_NAME)"; + SDKROOT = iphoneos; + SKIP_INSTALL = YES; + }; + name = Debug; + }; +/* End XCBuildConfiguration section */ + +/* Begin XCConfigurationList section */ + 2D8E8EC45A3A1A1D94AE762CB5028504 /* Build configuration list for PBXProject "Pods" */ = { + isa = XCConfigurationList; + buildConfigurations = ( + 8D1534490D941DCA47C62AC4314182AF /* Debug */, + C5A18280E9321A9268D1C80B7DA43967 /* Release */, + ); + defaultConfigurationIsVisible = 0; + defaultConfigurationName = Release; + }; + B9484451F110695C9C7315992FC1B452 /* Build configuration list for PBXNativeTarget "NYAlertViewController" */ = { + isa = XCConfigurationList; + buildConfigurations = ( + 20700B540BEC6E0FD549D756429D96D5 /* Debug */, + A4F9399B13A7DC99BD06B8A108DEC2FC /* Release */, + ); + defaultConfigurationIsVisible = 0; + defaultConfigurationName = Release; + }; + BBC03AB7103FAC54FA19B4A96689F639 /* Build configuration list for PBXNativeTarget "Pods" */ = { + isa = XCConfigurationList; + buildConfigurations = ( + FDFC2AB58C0E5F01A9E1214D90203CFD /* Debug */, + 223FD3CE64284CEBE1D80C4FF66EA2CD /* Release */, + ); + defaultConfigurationIsVisible = 0; + defaultConfigurationName = Release; + }; +/* End XCConfigurationList section */ + }; + rootObject = D41D8CD98F00B204E9800998ECF8427E /* Project object */; +} diff --git a/HeadsUpper/Pods/Snowflakes/LICENSE b/HeadsUpper/Pods/Snowflakes/LICENSE new file mode 100644 index 0000000..f1251d9 --- /dev/null +++ b/HeadsUpper/Pods/Snowflakes/LICENSE @@ -0,0 +1,19 @@ +Copyright (c) 2015 Martin Rogalla + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in +all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +THE SOFTWARE. diff --git a/HeadsUpper/Pods/Snowflakes/Pod/Classes/Snowflake.swift b/HeadsUpper/Pods/Snowflakes/Pod/Classes/Snowflake.swift new file mode 100644 index 0000000..f9f6b6c --- /dev/null +++ b/HeadsUpper/Pods/Snowflakes/Pod/Classes/Snowflake.swift @@ -0,0 +1,33 @@ +// +// Twitter: @MartinRogalla +// EmaiL: email@martinrogalla.com +// +// Created by Martin Rogalla. +// + +import UIKit + +class Snowflake : UIView { + override init (frame : CGRect) { + super.init(frame : frame) + self.backgroundColor = UIColor.whiteColor().colorWithAlphaComponent(0.7) + self.layer.cornerRadius = CGFloat(self.frame.width/2) + self.layer.borderWidth = 0.0 + } + + convenience init (position : CGPoint, minimumSize : Int, maximumSize : Int) { + let randomSize: CGFloat! + + if minimumSize < maximumSize { + randomSize = CGFloat(arc4random_uniform(UInt32(maximumSize - minimumSize)) + UInt32(minimumSize)) + } else { + //If the parameters passed in were not correct, we should flip which is the min and max + randomSize = CGFloat(arc4random_uniform(UInt32(minimumSize - maximumSize)) + UInt32(maximumSize)) + } + self.init(frame: CGRect(x: position.x, y: position.y, width: randomSize, height: randomSize)) + } + + required init(coder aDecoder: NSCoder) { + fatalError("This class does not support NSCoding") + } +} diff --git a/HeadsUpper/Pods/Snowflakes/Pod/Classes/SnowflakesView.swift b/HeadsUpper/Pods/Snowflakes/Pod/Classes/SnowflakesView.swift new file mode 100644 index 0000000..dd91868 --- /dev/null +++ b/HeadsUpper/Pods/Snowflakes/Pod/Classes/SnowflakesView.swift @@ -0,0 +1,102 @@ +// +// Twitter: @MartinRogalla +// EmaiL: email@martinrogalla.com +// +// Created by Martin Rogalla. +// + +import UIKit + +public class SnowflakesView : UIView { + + var animator1 : UIDynamicAnimator? + var animator2 : UIDynamicAnimator? + var snowflakes: [UIView] = [] + var gravityBehaviour1 = UIGravityBehavior() + var gravityBehaviour2 = UIGravityBehavior() + var gravityPullRight = false + + var timer : NSTimer? + + override public init (frame : CGRect) { + super.init(frame : frame) + initGravityAnimator() + timer = NSTimer.scheduledTimerWithTimeInterval(Double(arc4random_uniform(100))/100, target: self, selector: "changeGravityDirection", userInfo: nil, repeats: true) + } + + required public init(coder aDecoder: NSCoder) { + fatalError("This class does not support NSCoding") + } + + func initGravityAnimator() { + gravityBehaviour1.magnitude = 0.10 + gravityBehaviour1.gravityDirection.dx = 0.25 + gravityBehaviour2.magnitude = 0.20 + gravityBehaviour2.gravityDirection.dx = 0.25 + + self.animator1 = UIDynamicAnimator(referenceView: self) + self.animator1?.addBehavior(gravityBehaviour1) + + self.animator2 = UIDynamicAnimator(referenceView: self) + self.animator2?.addBehavior(gravityBehaviour2) + } + + func changeGravityDirection() { + dispatch_async(dispatch_get_main_queue()){ + if self.gravityPullRight { // Simulate wind, by changing gravity direction. + self.gravityBehaviour1.gravityDirection.dx += 0.4 + self.gravityBehaviour2.gravityDirection.dx += 0.5 + } else { + self.gravityBehaviour1.gravityDirection.dx -= 0.4 + self.gravityBehaviour2.gravityDirection.dx -= 0.5 + } + self.gravityPullRight = !self.gravityPullRight + } + if(self.snowflakes.count < 150) { + dispatch_async(dispatch_get_main_queue()) { + self.addNewSnowflake() + } + } + timer?.invalidate() + timer = NSTimer.scheduledTimerWithTimeInterval(Double(arc4random_uniform(100))/100, target: self, selector: "changeGravityDirection", userInfo: nil, repeats: true) + } + + func addNewSnowflake() { + let snowflakePosition = CGPoint(x: Int(arc4random_uniform(UInt32(self.bounds.width)) + 1), y: -Int(arc4random_uniform(200))) + let snowflake = Snowflake(position: snowflakePosition, minimumSize: 2, maximumSize: 4) + self.addSubview(snowflake) + + // Randomly assign the snowfalke to one of the two gravity environments. + if(Int(arc4random_uniform(2)) > 0) { + self.gravityBehaviour1.addItem(snowflake) + } else { + self.gravityBehaviour2.addItem(snowflake) + } + + snowflakes.append(snowflake) + startSnowflakeLifecycle(snowflake) + } + + func startSnowflakeLifecycle(snowflake: UIView) { + dispatch_after(dispatch_time(DISPATCH_TIME_NOW, Int64(Double(arc4random_uniform(100)+500)/100 * Double(NSEC_PER_SEC))), dispatch_get_main_queue()) { + // Remove the snowflake. + self.gravityBehaviour1.removeItem(snowflake) + self.gravityBehaviour2.removeItem(snowflake) + snowflake.removeFromSuperview() + self.snowflakes = self.snowflakes.filter{ item in return item != snowflake } + + // Spawn a new snowflake + self.addNewSnowflake() + } + } + + override public func hitTest(point: CGPoint, withEvent event: UIEvent?) -> UIView? { + let hitView = super.hitTest(point, withEvent: event) + + if hitView == self { + return nil + } + + return hitView + } +} diff --git a/HeadsUpper/Pods/Snowflakes/README.md b/HeadsUpper/Pods/Snowflakes/README.md new file mode 100644 index 0000000..f7af0b3 --- /dev/null +++ b/HeadsUpper/Pods/Snowflakes/README.md @@ -0,0 +1,52 @@ +# Snowflakes + +[![Version](https://img.shields.io/cocoapods/v/Snowflakes.svg?style=flat)](http://cocoapods.org/pods/Snowflakes) +[![License](https://img.shields.io/cocoapods/l/Snowflakes.svg?style=flat)](http://cocoapods.org/pods/Snowflakes) +[![Platform](https://img.shields.io/cocoapods/p/Snowflakes.svg?style=flat)](http://cocoapods.org/pods/Snowflakes) + +Snowflakes is an overlay view showing realistic falling snow. It is perfect to get your users in that winter holiday mood! + +## Screenshots +|![Snow falling on black background](http://i.imgur.com/chU5DyI.gif)|![Snow falling on picture by Emily Carlin](http://i.imgur.com/MXmfjx4.gif)| +|:-------------:|:-------------:| +| |*[Photo by Emily Carlin](https://flic.kr/p/7DyHES)*| + + + +## Usage + +To run the example project, clone the repo, and run `pod install` from the Example directory first. + +After [installing](#installation) the pod, import it using: +```swift +import Snowflakes +``` +Then add the SnowflakesView as a subview on your current view as such: +```swift +self.view.addSubview(SnowflakesView(frame: self.view.frame)) +``` +That's it. + +## Installation + +Snowflakes is available through [CocoaPods](http://cocoapods.org). To install +it, simply add the following line to your Podfile: + +```ruby +pod "Snowflakes" +``` + +## Contributors +### Author +Martin Rogalla, [@MartinRogalla](https://twitter.com/MartinRogalla) + +### External Contributors + +Daniel Becker, [@dabeck](https://github.com/dabeck) + +Brendan Kirchner, [@waterskier2007](https://github.com/waterskier2007) + +## License + +Snowflakes is available under the MIT license. See the LICENSE file for more info. + diff --git a/HeadsUpper/Pods/Target Support Files/NYAlertViewController/NYAlertViewController-Private.xcconfig b/HeadsUpper/Pods/Target Support Files/NYAlertViewController/NYAlertViewController-Private.xcconfig new file mode 100644 index 0000000..014f62d --- /dev/null +++ b/HeadsUpper/Pods/Target Support Files/NYAlertViewController/NYAlertViewController-Private.xcconfig @@ -0,0 +1,5 @@ +#include "NYAlertViewController.xcconfig" +GCC_PREPROCESSOR_DEFINITIONS = $(inherited) COCOAPODS=1 +HEADER_SEARCH_PATHS = "${PODS_ROOT}/Headers/Private" "${PODS_ROOT}/Headers/Private/NYAlertViewController" "${PODS_ROOT}/Headers/Public" "${PODS_ROOT}/Headers/Public/NYAlertViewController" +PODS_ROOT = ${SRCROOT} +SKIP_INSTALL = YES \ No newline at end of file diff --git a/HeadsUpper/Pods/Target Support Files/NYAlertViewController/NYAlertViewController-dummy.m b/HeadsUpper/Pods/Target Support Files/NYAlertViewController/NYAlertViewController-dummy.m new file mode 100644 index 0000000..f0f9cb2 --- /dev/null +++ b/HeadsUpper/Pods/Target Support Files/NYAlertViewController/NYAlertViewController-dummy.m @@ -0,0 +1,5 @@ +#import +@interface PodsDummy_NYAlertViewController : NSObject +@end +@implementation PodsDummy_NYAlertViewController +@end diff --git a/HeadsUpper/Pods/Target Support Files/NYAlertViewController/NYAlertViewController-prefix.pch b/HeadsUpper/Pods/Target Support Files/NYAlertViewController/NYAlertViewController-prefix.pch new file mode 100644 index 0000000..aa992a4 --- /dev/null +++ b/HeadsUpper/Pods/Target Support Files/NYAlertViewController/NYAlertViewController-prefix.pch @@ -0,0 +1,4 @@ +#ifdef __OBJC__ +#import +#endif + diff --git a/HeadsUpper/Pods/Target Support Files/NYAlertViewController/NYAlertViewController.xcconfig b/HeadsUpper/Pods/Target Support Files/NYAlertViewController/NYAlertViewController.xcconfig new file mode 100644 index 0000000..e69de29 diff --git a/HeadsUpper/Pods/Target Support Files/Pods/Pods-acknowledgements.markdown b/HeadsUpper/Pods/Target Support Files/Pods/Pods-acknowledgements.markdown new file mode 100644 index 0000000..74b3be8 --- /dev/null +++ b/HeadsUpper/Pods/Target Support Files/Pods/Pods-acknowledgements.markdown @@ -0,0 +1,28 @@ +# Acknowledgements +This application makes use of the following third party libraries: + +## NYAlertViewController + +The MIT License (MIT) + +Copyright (c) 2014 Nealon Young + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. + +Generated by CocoaPods - http://cocoapods.org diff --git a/HeadsUpper/Pods/Target Support Files/Pods/Pods-acknowledgements.plist b/HeadsUpper/Pods/Target Support Files/Pods/Pods-acknowledgements.plist new file mode 100644 index 0000000..b3343e6 --- /dev/null +++ b/HeadsUpper/Pods/Target Support Files/Pods/Pods-acknowledgements.plist @@ -0,0 +1,58 @@ + + + + + PreferenceSpecifiers + + + FooterText + This application makes use of the following third party libraries: + Title + Acknowledgements + Type + PSGroupSpecifier + + + FooterText + The MIT License (MIT) + +Copyright (c) 2014 Nealon Young + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. + + Title + NYAlertViewController + Type + PSGroupSpecifier + + + FooterText + Generated by CocoaPods - http://cocoapods.org + Title + + Type + PSGroupSpecifier + + + StringsTable + Acknowledgements + Title + Acknowledgements + + diff --git a/HeadsUpper/Pods/Target Support Files/Pods/Pods-dummy.m b/HeadsUpper/Pods/Target Support Files/Pods/Pods-dummy.m new file mode 100644 index 0000000..ade64bd --- /dev/null +++ b/HeadsUpper/Pods/Target Support Files/Pods/Pods-dummy.m @@ -0,0 +1,5 @@ +#import +@interface PodsDummy_Pods : NSObject +@end +@implementation PodsDummy_Pods +@end diff --git a/HeadsUpper/Pods/Target Support Files/Pods/Pods-resources.sh b/HeadsUpper/Pods/Target Support Files/Pods/Pods-resources.sh new file mode 100755 index 0000000..ea685a2 --- /dev/null +++ b/HeadsUpper/Pods/Target Support Files/Pods/Pods-resources.sh @@ -0,0 +1,95 @@ +#!/bin/sh +set -e + +mkdir -p "${CONFIGURATION_BUILD_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}" + +RESOURCES_TO_COPY=${PODS_ROOT}/resources-to-copy-${TARGETNAME}.txt +> "$RESOURCES_TO_COPY" + +XCASSET_FILES=() + +realpath() { + DIRECTORY="$(cd "${1%/*}" && pwd)" + FILENAME="${1##*/}" + echo "$DIRECTORY/$FILENAME" +} + +install_resource() +{ + case $1 in + *.storyboard) + echo "ibtool --reference-external-strings-file --errors --warnings --notices --output-format human-readable-text --compile ${CONFIGURATION_BUILD_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}/`basename \"$1\" .storyboard`.storyboardc ${PODS_ROOT}/$1 --sdk ${SDKROOT}" + ibtool --reference-external-strings-file --errors --warnings --notices --output-format human-readable-text --compile "${CONFIGURATION_BUILD_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}/`basename \"$1\" .storyboard`.storyboardc" "${PODS_ROOT}/$1" --sdk "${SDKROOT}" + ;; + *.xib) + echo "ibtool --reference-external-strings-file --errors --warnings --notices --output-format human-readable-text --compile ${CONFIGURATION_BUILD_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}/`basename \"$1\" .xib`.nib ${PODS_ROOT}/$1 --sdk ${SDKROOT}" + ibtool --reference-external-strings-file --errors --warnings --notices --output-format human-readable-text --compile "${CONFIGURATION_BUILD_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}/`basename \"$1\" .xib`.nib" "${PODS_ROOT}/$1" --sdk "${SDKROOT}" + ;; + *.framework) + echo "mkdir -p ${CONFIGURATION_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}" + mkdir -p "${CONFIGURATION_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}" + echo "rsync -av ${PODS_ROOT}/$1 ${CONFIGURATION_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}" + rsync -av "${PODS_ROOT}/$1" "${CONFIGURATION_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}" + ;; + *.xcdatamodel) + echo "xcrun momc \"${PODS_ROOT}/$1\" \"${CONFIGURATION_BUILD_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}/`basename "$1"`.mom\"" + xcrun momc "${PODS_ROOT}/$1" "${CONFIGURATION_BUILD_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}/`basename "$1" .xcdatamodel`.mom" + ;; + *.xcdatamodeld) + echo "xcrun momc \"${PODS_ROOT}/$1\" \"${CONFIGURATION_BUILD_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}/`basename "$1" .xcdatamodeld`.momd\"" + xcrun momc "${PODS_ROOT}/$1" "${CONFIGURATION_BUILD_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}/`basename "$1" .xcdatamodeld`.momd" + ;; + *.xcmappingmodel) + echo "xcrun mapc \"${PODS_ROOT}/$1\" \"${CONFIGURATION_BUILD_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}/`basename "$1" .xcmappingmodel`.cdm\"" + xcrun mapc "${PODS_ROOT}/$1" "${CONFIGURATION_BUILD_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}/`basename "$1" .xcmappingmodel`.cdm" + ;; + *.xcassets) + ABSOLUTE_XCASSET_FILE=$(realpath "${PODS_ROOT}/$1") + XCASSET_FILES+=("$ABSOLUTE_XCASSET_FILE") + ;; + /*) + echo "$1" + echo "$1" >> "$RESOURCES_TO_COPY" + ;; + *) + echo "${PODS_ROOT}/$1" + echo "${PODS_ROOT}/$1" >> "$RESOURCES_TO_COPY" + ;; + esac +} + +mkdir -p "${CONFIGURATION_BUILD_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}" +rsync -avr --copy-links --no-relative --exclude '*/.svn/*' --files-from="$RESOURCES_TO_COPY" / "${CONFIGURATION_BUILD_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}" +if [[ "${ACTION}" == "install" ]]; then + mkdir -p "${INSTALL_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}" + rsync -avr --copy-links --no-relative --exclude '*/.svn/*' --files-from="$RESOURCES_TO_COPY" / "${INSTALL_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}" +fi +rm -f "$RESOURCES_TO_COPY" + +if [[ -n "${WRAPPER_EXTENSION}" ]] && [ "`xcrun --find actool`" ] && [ -n "$XCASSET_FILES" ] +then + case "${TARGETED_DEVICE_FAMILY}" in + 1,2) + TARGET_DEVICE_ARGS="--target-device ipad --target-device iphone" + ;; + 1) + TARGET_DEVICE_ARGS="--target-device iphone" + ;; + 2) + TARGET_DEVICE_ARGS="--target-device ipad" + ;; + *) + TARGET_DEVICE_ARGS="--target-device mac" + ;; + esac + + # Find all other xcassets (this unfortunately includes those of path pods and other targets). + OTHER_XCASSETS=$(find "$PWD" -iname "*.xcassets" -type d) + while read line; do + if [[ $line != "`realpath $PODS_ROOT`*" ]]; then + XCASSET_FILES+=("$line") + fi + done <<<"$OTHER_XCASSETS" + + printf "%s\0" "${XCASSET_FILES[@]}" | xargs -0 xcrun actool --output-format human-readable-text --notices --warnings --platform "${PLATFORM_NAME}" --minimum-deployment-target "${IPHONEOS_DEPLOYMENT_TARGET}" ${TARGET_DEVICE_ARGS} --compress-pngs --compile "${BUILT_PRODUCTS_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}" +fi diff --git a/HeadsUpper/Pods/Target Support Files/Pods/Pods.debug.xcconfig b/HeadsUpper/Pods/Target Support Files/Pods/Pods.debug.xcconfig new file mode 100644 index 0000000..5eafb3e --- /dev/null +++ b/HeadsUpper/Pods/Target Support Files/Pods/Pods.debug.xcconfig @@ -0,0 +1,5 @@ +GCC_PREPROCESSOR_DEFINITIONS = $(inherited) COCOAPODS=1 +HEADER_SEARCH_PATHS = $(inherited) "${PODS_ROOT}/Headers/Public" "${PODS_ROOT}/Headers/Public/NYAlertViewController" +OTHER_CFLAGS = $(inherited) -isystem "${PODS_ROOT}/Headers/Public" -isystem "${PODS_ROOT}/Headers/Public/NYAlertViewController" +OTHER_LDFLAGS = $(inherited) -ObjC -l"NYAlertViewController" +PODS_ROOT = ${SRCROOT}/Pods \ No newline at end of file diff --git a/HeadsUpper/Pods/Target Support Files/Pods/Pods.release.xcconfig b/HeadsUpper/Pods/Target Support Files/Pods/Pods.release.xcconfig new file mode 100644 index 0000000..5eafb3e --- /dev/null +++ b/HeadsUpper/Pods/Target Support Files/Pods/Pods.release.xcconfig @@ -0,0 +1,5 @@ +GCC_PREPROCESSOR_DEFINITIONS = $(inherited) COCOAPODS=1 +HEADER_SEARCH_PATHS = $(inherited) "${PODS_ROOT}/Headers/Public" "${PODS_ROOT}/Headers/Public/NYAlertViewController" +OTHER_CFLAGS = $(inherited) -isystem "${PODS_ROOT}/Headers/Public" -isystem "${PODS_ROOT}/Headers/Public/NYAlertViewController" +OTHER_LDFLAGS = $(inherited) -ObjC -l"NYAlertViewController" +PODS_ROOT = ${SRCROOT}/Pods \ No newline at end of file diff --git a/Podfile b/Podfile new file mode 100644 index 0000000..d256550 --- /dev/null +++ b/Podfile @@ -0,0 +1 @@ +pod 'NYAlertViewController' \ No newline at end of file