diff --git a/PartTwo/PartTwo.xcodeproj/project.pbxproj b/PartTwo/PartTwo.xcodeproj/project.pbxproj index 5582517..239fc09 100644 --- a/PartTwo/PartTwo.xcodeproj/project.pbxproj +++ b/PartTwo/PartTwo.xcodeproj/project.pbxproj @@ -7,12 +7,14 @@ objects = { /* Begin PBXBuildFile section */ + 3D6A20A71BA9F3F900ECAD1D /* CustomView.xib in Resources */ = {isa = PBXBuildFile; fileRef = 3D6A20A61BA9F3F900ECAD1D /* CustomView.xib */; }; + 3D6A20AA1BA9F56D00ECAD1D /* CustomView.m in Sources */ = {isa = PBXBuildFile; fileRef = 3D6A20A91BA9F56D00ECAD1D /* CustomView.m */; }; + 3D6A20B01BAA02C500ECAD1D /* BackgroundGradient.m in Sources */ = {isa = PBXBuildFile; fileRef = 3D6A20AF1BAA02C500ECAD1D /* BackgroundGradient.m */; }; 8DD103491BA66E0900CE483B /* main.m in Sources */ = {isa = PBXBuildFile; fileRef = 8DD103481BA66E0900CE483B /* main.m */; }; 8DD1034C1BA66E0900CE483B /* AppDelegate.m in Sources */ = {isa = PBXBuildFile; fileRef = 8DD1034B1BA66E0900CE483B /* AppDelegate.m */; }; 8DD1034F1BA66E0900CE483B /* ViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = 8DD1034E1BA66E0900CE483B /* ViewController.m */; }; 8DD103521BA66E0900CE483B /* Main.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 8DD103501BA66E0900CE483B /* Main.storyboard */; }; 8DD103541BA66E0900CE483B /* Assets.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = 8DD103531BA66E0900CE483B /* Assets.xcassets */; }; - 8DD103571BA66E0900CE483B /* LaunchScreen.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 8DD103551BA66E0900CE483B /* LaunchScreen.storyboard */; }; 8DD103621BA66E0900CE483B /* PartTwoTests.m in Sources */ = {isa = PBXBuildFile; fileRef = 8DD103611BA66E0900CE483B /* PartTwoTests.m */; }; 8DD1036D1BA66E0900CE483B /* PartTwoUITests.m in Sources */ = {isa = PBXBuildFile; fileRef = 8DD1036C1BA66E0900CE483B /* PartTwoUITests.m */; }; /* End PBXBuildFile section */ @@ -35,6 +37,12 @@ /* End PBXContainerItemProxy section */ /* Begin PBXFileReference section */ + 3D3A24801BA76BE3008E7269 /* SocialMediaDelegate.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SocialMediaDelegate.h; sourceTree = ""; }; + 3D6A20A61BA9F3F900ECAD1D /* CustomView.xib */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = file.xib; path = CustomView.xib; sourceTree = ""; }; + 3D6A20A81BA9F56D00ECAD1D /* CustomView.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = CustomView.h; sourceTree = ""; }; + 3D6A20A91BA9F56D00ECAD1D /* CustomView.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = CustomView.m; sourceTree = ""; }; + 3D6A20AE1BAA02C500ECAD1D /* BackgroundGradient.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = BackgroundGradient.h; sourceTree = ""; }; + 3D6A20AF1BAA02C500ECAD1D /* BackgroundGradient.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = BackgroundGradient.m; sourceTree = ""; }; 8DD103441BA66E0900CE483B /* PartTwo.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = PartTwo.app; sourceTree = BUILT_PRODUCTS_DIR; }; 8DD103481BA66E0900CE483B /* main.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = main.m; sourceTree = ""; }; 8DD1034A1BA66E0900CE483B /* AppDelegate.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = AppDelegate.h; sourceTree = ""; }; @@ -43,7 +51,6 @@ 8DD1034E1BA66E0900CE483B /* ViewController.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = ViewController.m; sourceTree = ""; }; 8DD103511BA66E0900CE483B /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; name = Base; path = Base.lproj/Main.storyboard; sourceTree = ""; }; 8DD103531BA66E0900CE483B /* Assets.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; path = Assets.xcassets; sourceTree = ""; }; - 8DD103561BA66E0900CE483B /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; name = Base; path = Base.lproj/LaunchScreen.storyboard; sourceTree = ""; }; 8DD103581BA66E0900CE483B /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = ""; }; 8DD1035D1BA66E0900CE483B /* PartTwoTests.xctest */ = {isa = PBXFileReference; explicitFileType = wrapper.cfbundle; includeInIndex = 0; path = PartTwoTests.xctest; sourceTree = BUILT_PRODUCTS_DIR; }; 8DD103611BA66E0900CE483B /* PartTwoTests.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = PartTwoTests.m; sourceTree = ""; }; @@ -105,11 +112,16 @@ 8DD1034B1BA66E0900CE483B /* AppDelegate.m */, 8DD1034D1BA66E0900CE483B /* ViewController.h */, 8DD1034E1BA66E0900CE483B /* ViewController.m */, + 3D3A24801BA76BE3008E7269 /* SocialMediaDelegate.h */, 8DD103501BA66E0900CE483B /* Main.storyboard */, 8DD103531BA66E0900CE483B /* Assets.xcassets */, - 8DD103551BA66E0900CE483B /* LaunchScreen.storyboard */, 8DD103581BA66E0900CE483B /* Info.plist */, 8DD103471BA66E0900CE483B /* Supporting Files */, + 3D6A20A61BA9F3F900ECAD1D /* CustomView.xib */, + 3D6A20A81BA9F56D00ECAD1D /* CustomView.h */, + 3D6A20A91BA9F56D00ECAD1D /* CustomView.m */, + 3D6A20AE1BAA02C500ECAD1D /* BackgroundGradient.h */, + 3D6A20AF1BAA02C500ECAD1D /* BackgroundGradient.m */, ); path = PartTwo; sourceTree = ""; @@ -243,9 +255,9 @@ isa = PBXResourcesBuildPhase; buildActionMask = 2147483647; files = ( - 8DD103571BA66E0900CE483B /* LaunchScreen.storyboard in Resources */, 8DD103541BA66E0900CE483B /* Assets.xcassets in Resources */, 8DD103521BA66E0900CE483B /* Main.storyboard in Resources */, + 3D6A20A71BA9F3F900ECAD1D /* CustomView.xib in Resources */, ); runOnlyForDeploymentPostprocessing = 0; }; @@ -270,8 +282,10 @@ isa = PBXSourcesBuildPhase; buildActionMask = 2147483647; files = ( + 3D6A20AA1BA9F56D00ECAD1D /* CustomView.m in Sources */, 8DD1034F1BA66E0900CE483B /* ViewController.m in Sources */, 8DD1034C1BA66E0900CE483B /* AppDelegate.m in Sources */, + 3D6A20B01BAA02C500ECAD1D /* BackgroundGradient.m in Sources */, 8DD103491BA66E0900CE483B /* main.m in Sources */, ); runOnlyForDeploymentPostprocessing = 0; @@ -316,14 +330,6 @@ name = Main.storyboard; sourceTree = ""; }; - 8DD103551BA66E0900CE483B /* LaunchScreen.storyboard */ = { - isa = PBXVariantGroup; - children = ( - 8DD103561BA66E0900CE483B /* Base */, - ); - name = LaunchScreen.storyboard; - sourceTree = ""; - }; /* End PBXVariantGroup section */ /* Begin XCBuildConfiguration section */ @@ -436,6 +442,7 @@ buildSettings = { BUNDLE_LOADER = "$(TEST_HOST)"; INFOPLIST_FILE = PartTwoTests/Info.plist; + IPHONEOS_DEPLOYMENT_TARGET = 8.4; LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks"; PRODUCT_BUNDLE_IDENTIFIER = com.mikekavouras.PartTwoTests; PRODUCT_NAME = "$(TARGET_NAME)"; @@ -448,6 +455,7 @@ buildSettings = { BUNDLE_LOADER = "$(TEST_HOST)"; INFOPLIST_FILE = PartTwoTests/Info.plist; + IPHONEOS_DEPLOYMENT_TARGET = 8.4; LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks"; PRODUCT_BUNDLE_IDENTIFIER = com.mikekavouras.PartTwoTests; PRODUCT_NAME = "$(TARGET_NAME)"; @@ -459,6 +467,7 @@ isa = XCBuildConfiguration; buildSettings = { INFOPLIST_FILE = PartTwoUITests/Info.plist; + IPHONEOS_DEPLOYMENT_TARGET = 8.4; LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks"; PRODUCT_BUNDLE_IDENTIFIER = com.mikekavouras.PartTwoUITests; PRODUCT_NAME = "$(TARGET_NAME)"; @@ -471,6 +480,7 @@ isa = XCBuildConfiguration; buildSettings = { INFOPLIST_FILE = PartTwoUITests/Info.plist; + IPHONEOS_DEPLOYMENT_TARGET = 8.4; LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks"; PRODUCT_BUNDLE_IDENTIFIER = com.mikekavouras.PartTwoUITests; PRODUCT_NAME = "$(TARGET_NAME)"; @@ -498,6 +508,7 @@ 8DD103731BA66E0900CE483B /* Release */, ); defaultConfigurationIsVisible = 0; + defaultConfigurationName = Release; }; 8DD103741BA66E0900CE483B /* Build configuration list for PBXNativeTarget "PartTwoTests" */ = { isa = XCConfigurationList; @@ -506,6 +517,7 @@ 8DD103761BA66E0900CE483B /* Release */, ); defaultConfigurationIsVisible = 0; + defaultConfigurationName = Release; }; 8DD103771BA66E0900CE483B /* Build configuration list for PBXNativeTarget "PartTwoUITests" */ = { isa = XCConfigurationList; @@ -514,6 +526,7 @@ 8DD103791BA66E0900CE483B /* Release */, ); defaultConfigurationIsVisible = 0; + defaultConfigurationName = Release; }; /* End XCConfigurationList section */ }; diff --git a/PartTwo/PartTwo.xcodeproj/project.xcworkspace/xcshareddata/PartTwo.xccheckout b/PartTwo/PartTwo.xcodeproj/project.xcworkspace/xcshareddata/PartTwo.xccheckout new file mode 100644 index 0000000..e7663ad --- /dev/null +++ b/PartTwo/PartTwo.xcodeproj/project.xcworkspace/xcshareddata/PartTwo.xccheckout @@ -0,0 +1,41 @@ + + + + + IDESourceControlProjectFavoriteDictionaryKey + + IDESourceControlProjectIdentifier + AB9B810A-2527-47F5-B23F-18C52754AC1B + IDESourceControlProjectName + PartTwo + IDESourceControlProjectOriginsDictionary + + 30574ED234DE2144597F5C1E54D4E002E32C4ECC + https://github.com/Zovfreullia/unit-2-hw-0.git + + IDESourceControlProjectPath + PartTwo/PartTwo.xcodeproj + IDESourceControlProjectRelativeInstallPathDictionary + + 30574ED234DE2144597F5C1E54D4E002E32C4ECC + ../../.. + + IDESourceControlProjectURL + https://github.com/Zovfreullia/unit-2-hw-0.git + IDESourceControlProjectVersion + 111 + IDESourceControlProjectWCCIdentifier + 30574ED234DE2144597F5C1E54D4E002E32C4ECC + IDESourceControlProjectWCConfigurations + + + IDESourceControlRepositoryExtensionIdentifierKey + public.vcs.git + IDESourceControlWCCIdentifierKey + 30574ED234DE2144597F5C1E54D4E002E32C4ECC + IDESourceControlWCCName + unit-2-hw-0 + + + + diff --git a/PartTwo/PartTwo.xcodeproj/project.xcworkspace/xcuserdata/Mima.xcuserdatad/UserInterfaceState.xcuserstate b/PartTwo/PartTwo.xcodeproj/project.xcworkspace/xcuserdata/Mima.xcuserdatad/UserInterfaceState.xcuserstate new file mode 100644 index 0000000..8dd4e7f Binary files /dev/null and b/PartTwo/PartTwo.xcodeproj/project.xcworkspace/xcuserdata/Mima.xcuserdatad/UserInterfaceState.xcuserstate differ diff --git a/PartTwo/PartTwo.xcodeproj/xcuserdata/Mima.xcuserdatad/xcdebugger/Breakpoints_v2.xcbkptlist b/PartTwo/PartTwo.xcodeproj/xcuserdata/Mima.xcuserdatad/xcdebugger/Breakpoints_v2.xcbkptlist new file mode 100644 index 0000000..8f94031 --- /dev/null +++ b/PartTwo/PartTwo.xcodeproj/xcuserdata/Mima.xcuserdatad/xcdebugger/Breakpoints_v2.xcbkptlist @@ -0,0 +1,17 @@ + + + + + + + + + diff --git a/PartTwo/PartTwo.xcodeproj/xcuserdata/Mima.xcuserdatad/xcschemes/PartTwo.xcscheme b/PartTwo/PartTwo.xcodeproj/xcuserdata/Mima.xcuserdatad/xcschemes/PartTwo.xcscheme new file mode 100644 index 0000000..7b83b68 --- /dev/null +++ b/PartTwo/PartTwo.xcodeproj/xcuserdata/Mima.xcuserdatad/xcschemes/PartTwo.xcscheme @@ -0,0 +1,111 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/PartTwo/PartTwo.xcodeproj/xcuserdata/Mima.xcuserdatad/xcschemes/xcschememanagement.plist b/PartTwo/PartTwo.xcodeproj/xcuserdata/Mima.xcuserdatad/xcschemes/xcschememanagement.plist new file mode 100644 index 0000000..8d9c097 --- /dev/null +++ b/PartTwo/PartTwo.xcodeproj/xcuserdata/Mima.xcuserdatad/xcschemes/xcschememanagement.plist @@ -0,0 +1,32 @@ + + + + + SchemeUserState + + PartTwo.xcscheme + + orderHint + 0 + + + SuppressBuildableAutocreation + + 8DD103431BA66E0900CE483B + + primary + + + 8DD1035C1BA66E0900CE483B + + primary + + + 8DD103671BA66E0900CE483B + + primary + + + + + diff --git a/PartTwo/PartTwo/AppDelegate.m b/PartTwo/PartTwo/AppDelegate.m index ec03d17..e8062af 100644 --- a/PartTwo/PartTwo/AppDelegate.m +++ b/PartTwo/PartTwo/AppDelegate.m @@ -8,7 +8,7 @@ #import "AppDelegate.h" -@interface AppDelegate () +@interface AppDelegate () @end diff --git a/PartTwo/PartTwo/BackgroundGradient.h b/PartTwo/PartTwo/BackgroundGradient.h new file mode 100644 index 0000000..fe4e8d8 --- /dev/null +++ b/PartTwo/PartTwo/BackgroundGradient.h @@ -0,0 +1,17 @@ +// +// BackgroundGradient.h +// unit-1-final-project +// +// Created by Fatima Zenine Villanueva on 8/26/15. +// Copyright © 2015 apps. All rights reserved. +// + +#import +#import + +@interface BackgroundGradient : NSObject ++(CAGradientLayer*) redGradient; ++(CAGradientLayer*) blueGradient; ++(CAGradientLayer*) greenGradient; + +@end \ No newline at end of file diff --git a/PartTwo/PartTwo/BackgroundGradient.m b/PartTwo/PartTwo/BackgroundGradient.m new file mode 100644 index 0000000..3f1f994 --- /dev/null +++ b/PartTwo/PartTwo/BackgroundGradient.m @@ -0,0 +1,74 @@ +// +// BackgroundGradient.m +// unit-1-final-project +// +// Created by Fatima Zenine Villanueva on 8/26/15. +// Copyright © 2015 apps. All rights reserved. +// + +#import "BackgroundGradient.h" +#import + +@implementation BackgroundGradient + +//Metallic grey gradient background ++ (CAGradientLayer*) redGradient { + + UIColor *colorOne = [UIColor colorWithRed:(200.0/255.0) green:(135/255.0) blue:(150/255.0) alpha:1.0]; + UIColor *colorTwo = [UIColor colorWithRed:(60.0/255.0) green:(15.0/255.0) blue:(40.0/255.0) alpha:1.0]; + + NSArray *colors = [NSArray arrayWithObjects:(id)colorOne.CGColor, colorTwo.CGColor, nil]; + NSNumber *stopOne = [NSNumber numberWithFloat:0.0]; + NSNumber *stopTwo = [NSNumber numberWithFloat:1.0]; + + NSArray *locations = [NSArray arrayWithObjects:stopOne, stopTwo, nil]; + + CAGradientLayer *headerLayer = [CAGradientLayer layer]; + headerLayer.colors = colors; + headerLayer.locations = locations; + + return headerLayer; + +} + +//Blue gradient background ++ (CAGradientLayer*) blueGradient { + + UIColor *colorOne = [UIColor colorWithRed:(135.0/255.0) green:(150.0/255.0) blue:(200.0/255.0) alpha:1.0]; + UIColor *colorTwo = [UIColor colorWithRed:(15.0/255.0) green:(40.0/255.0) blue:(60.0/255.0) alpha:1.0]; + + NSArray *colors = [NSArray arrayWithObjects:(id)colorOne.CGColor, colorTwo.CGColor, nil]; + NSNumber *stopOne = [NSNumber numberWithFloat:0.0]; + NSNumber *stopTwo = [NSNumber numberWithFloat:1.0]; + + NSArray *locations = [NSArray arrayWithObjects:stopOne, stopTwo, nil]; + + CAGradientLayer *headerLayer = [CAGradientLayer layer]; + headerLayer.colors = colors; + headerLayer.locations = locations; + + return headerLayer; + +} + ++ (CAGradientLayer*) greenGradient { + + UIColor *colorOne = [UIColor colorWithRed:(135.0/255.0) green:(200.0/255.0) blue:(150.0/255.0) alpha:1.0]; + UIColor *colorTwo = [UIColor colorWithRed:(15.0/255.0) green:(60.0/255.0) blue:(40.0/255.0) alpha:1.0]; + + NSArray *colors = [NSArray arrayWithObjects:(id)colorOne.CGColor, colorTwo.CGColor, nil]; + NSNumber *stopOne = [NSNumber numberWithFloat:0.0]; + NSNumber *stopTwo = [NSNumber numberWithFloat:1.0]; + + NSArray *locations = [NSArray arrayWithObjects:stopOne, stopTwo, nil]; + + CAGradientLayer *headerLayer = [CAGradientLayer layer]; + headerLayer.colors = colors; + headerLayer.locations = locations; + + return headerLayer; + +} + + +@end \ No newline at end of file diff --git a/PartTwo/PartTwo/Base.lproj/LaunchScreen.storyboard b/PartTwo/PartTwo/Base.lproj/LaunchScreen.storyboard deleted file mode 100644 index 2e721e1..0000000 --- a/PartTwo/PartTwo/Base.lproj/LaunchScreen.storyboard +++ /dev/null @@ -1,27 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/PartTwo/PartTwo/Base.lproj/Main.storyboard b/PartTwo/PartTwo/Base.lproj/Main.storyboard index f56d2f3..70a8c5d 100644 --- a/PartTwo/PartTwo/Base.lproj/Main.storyboard +++ b/PartTwo/PartTwo/Base.lproj/Main.storyboard @@ -1,25 +1,44 @@ - + - + + - + - + - - + + - + - + + + + + + + + + + + + + + + + + + - + + diff --git a/PartTwo/PartTwo/CustomView.h b/PartTwo/PartTwo/CustomView.h new file mode 100644 index 0000000..21e4680 --- /dev/null +++ b/PartTwo/PartTwo/CustomView.h @@ -0,0 +1,17 @@ +// +// CustomView.h +// PartTwo +// +// Created by Fatima Zenine Villanueva on 9/16/15. +// Copyright © 2015 Mike Kavouras. All rights reserved. +// + +#import +#import "SocialMediaDelegate.h" + +@interface CustomView : UIView + +@property (nonatomic, weak) id delegate; + + +@end diff --git a/PartTwo/PartTwo/CustomView.m b/PartTwo/PartTwo/CustomView.m new file mode 100644 index 0000000..12fd36e --- /dev/null +++ b/PartTwo/PartTwo/CustomView.m @@ -0,0 +1,41 @@ +// +// CustomView.m +// PartTwo +// +// Created by Fatima Zenine Villanueva on 9/16/15. +// Copyright © 2015 Mike Kavouras. All rights reserved. +// + +#import "CustomView.h" + +@implementation CustomView +- (IBAction)comment:(id)sender { + NSLog(@"comment button"); + [self.delegate testing:@"This is the color blue from the delegate"]; + [self.delegate socialMediaViewDidTapCommentButton]; + NSLog(@"This is the delegate: %@", self.delegate); +} +- (IBAction)like:(id)sender { + NSLog(@"like button"); + [self.delegate socialMediaViewDidTapLikeButton]; + [self.delegate testing:@"This is the color orange from the delegate"]; + + +} +- (IBAction)share:(id)sender { + NSLog(@"share button"); + [self.delegate socialMediaViewDidTapShareButton]; + [self.delegate testing:@"This is the color pink from the delegate"]; + + +} + +/* +// Only override drawRect: if you perform custom drawing. +// An empty implementation adversely affects performance during animation. +- (void)drawRect:(CGRect)rect { + // Drawing code +} +*/ + +@end diff --git a/PartTwo/PartTwo/CustomView.xib b/PartTwo/PartTwo/CustomView.xib new file mode 100644 index 0000000..4036a7a --- /dev/null +++ b/PartTwo/PartTwo/CustomView.xib @@ -0,0 +1,59 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/PartTwo/PartTwo/SocialMediaDelegate.h b/PartTwo/PartTwo/SocialMediaDelegate.h new file mode 100644 index 0000000..b13d5a8 --- /dev/null +++ b/PartTwo/PartTwo/SocialMediaDelegate.h @@ -0,0 +1,20 @@ +// +// SocialMediaDelegate.h +// PartTwo +// +// Created by Fatima Zenine Villanueva on 9/14/15. +// Copyright © 2015 Mike Kavouras. All rights reserved. +// + +#import + +@protocol SocialMediaDelegate + +@required +- (void)socialMediaViewDidTapLikeButton; +- (void)socialMediaViewDidTapCommentButton; +- (void)socialMediaViewDidTapShareButton; +- (void)testing: (NSString *)stringTest; + +@end + diff --git a/PartTwo/PartTwo/ViewController.h b/PartTwo/PartTwo/ViewController.h index cb5d98b..cf35023 100644 --- a/PartTwo/PartTwo/ViewController.h +++ b/PartTwo/PartTwo/ViewController.h @@ -7,9 +7,9 @@ // #import +#import "SocialMediaDelegate.h" @interface ViewController : UIViewController - @end diff --git a/PartTwo/PartTwo/ViewController.m b/PartTwo/PartTwo/ViewController.m index adca251..f23acc1 100644 --- a/PartTwo/PartTwo/ViewController.m +++ b/PartTwo/PartTwo/ViewController.m @@ -7,18 +7,65 @@ // #import "ViewController.h" +#import "SocialMediaDelegate.h" +#import "CustomView.h" +#import "BackgroundGradient.h" -@interface ViewController () +@interface ViewController () + +@property (weak, nonatomic) IBOutlet UIView *customView; + +@property (nonatomic) CAGradientLayer *bgLayer; @end @implementation ViewController + - (void)viewDidLoad { [super viewDidLoad]; - // Do any additional setup after loading the view, typically from a nib. + + + NSArray *views = [[NSBundle mainBundle]loadNibNamed:@"CustomView"owner:self options:nil]; + + CustomView *customView = [views firstObject]; + + [self.customView addSubview:customView]; + + customView.frame = self.customView.bounds; + + customView.delegate = self; + +} + + + +- (void)socialMediaViewDidTapCommentButton { + [self.bgLayer removeFromSuperlayer]; + self.bgLayer = [BackgroundGradient greenGradient]; + self.bgLayer.frame = self.view.bounds; + [self.view.layer insertSublayer:self.bgLayer atIndex:0]; } +-(void)socialMediaViewDidTapLikeButton { + [self.bgLayer removeFromSuperlayer]; + self.bgLayer = [BackgroundGradient blueGradient]; + self.bgLayer.frame = self.view.bounds; + [self.view.layer insertSublayer:self.bgLayer atIndex:0]; +} +- (void)socialMediaViewDidTapShareButton { + [self.bgLayer removeFromSuperlayer]; + self.bgLayer = [BackgroundGradient redGradient]; + self.bgLayer.frame = self.view.bounds; + [self.view.layer insertSublayer:self.bgLayer atIndex:0]; +} + +- (void)testing: (NSString *)stringTest{ + NSLog(@"%@",stringTest); +} + + + - (void)didReceiveMemoryWarning { [super didReceiveMemoryWarning]; // Dispose of any resources that can be recreated. diff --git a/PickAPic/PickAPic.xcodeproj/project.pbxproj b/PickAPic/PickAPic.xcodeproj/project.pbxproj index 049896b..404cd78 100644 --- a/PickAPic/PickAPic.xcodeproj/project.pbxproj +++ b/PickAPic/PickAPic.xcodeproj/project.pbxproj @@ -207,6 +207,7 @@ TargetAttributes = { 8D1F73BB1BA66AE50040D369 = { CreatedOnToolsVersion = 7.0; + DevelopmentTeam = 3358H79N3F; }; 8D1F73D41BA66AE50040D369 = { CreatedOnToolsVersion = 7.0; @@ -411,11 +412,14 @@ isa = XCBuildConfiguration; buildSettings = { ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; + CODE_SIGN_IDENTITY = "iPhone Developer"; + "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer"; INFOPLIST_FILE = PickAPic/Info.plist; - IPHONEOS_DEPLOYMENT_TARGET = 8.2; + IPHONEOS_DEPLOYMENT_TARGET = 8.1; LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks"; PRODUCT_BUNDLE_IDENTIFIER = com.mikekavouras.PickAPic; PRODUCT_NAME = "$(TARGET_NAME)"; + PROVISIONING_PROFILE = ""; }; name = Debug; }; @@ -423,11 +427,14 @@ isa = XCBuildConfiguration; buildSettings = { ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; + CODE_SIGN_IDENTITY = "iPhone Developer"; + "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer"; INFOPLIST_FILE = PickAPic/Info.plist; - IPHONEOS_DEPLOYMENT_TARGET = 8.2; + IPHONEOS_DEPLOYMENT_TARGET = 8.1; LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks"; PRODUCT_BUNDLE_IDENTIFIER = com.mikekavouras.PickAPic; PRODUCT_NAME = "$(TARGET_NAME)"; + PROVISIONING_PROFILE = ""; }; name = Release; }; diff --git a/PickAPic/PickAPic.xcodeproj/project.xcworkspace/xcuserdata/Mima.xcuserdatad/UserInterfaceState.xcuserstate b/PickAPic/PickAPic.xcodeproj/project.xcworkspace/xcuserdata/Mima.xcuserdatad/UserInterfaceState.xcuserstate new file mode 100644 index 0000000..0031be2 Binary files /dev/null and b/PickAPic/PickAPic.xcodeproj/project.xcworkspace/xcuserdata/Mima.xcuserdatad/UserInterfaceState.xcuserstate differ diff --git a/PickAPic/PickAPic.xcodeproj/xcuserdata/Mima.xcuserdatad/xcschemes/PickAPic.xcscheme b/PickAPic/PickAPic.xcodeproj/xcuserdata/Mima.xcuserdatad/xcschemes/PickAPic.xcscheme new file mode 100644 index 0000000..72d7729 --- /dev/null +++ b/PickAPic/PickAPic.xcodeproj/xcuserdata/Mima.xcuserdatad/xcschemes/PickAPic.xcscheme @@ -0,0 +1,111 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/PickAPic/PickAPic.xcodeproj/xcuserdata/Mima.xcuserdatad/xcschemes/xcschememanagement.plist b/PickAPic/PickAPic.xcodeproj/xcuserdata/Mima.xcuserdatad/xcschemes/xcschememanagement.plist new file mode 100644 index 0000000..bb91a10 --- /dev/null +++ b/PickAPic/PickAPic.xcodeproj/xcuserdata/Mima.xcuserdatad/xcschemes/xcschememanagement.plist @@ -0,0 +1,32 @@ + + + + + SchemeUserState + + PickAPic.xcscheme + + orderHint + 0 + + + SuppressBuildableAutocreation + + 8D1F73BB1BA66AE50040D369 + + primary + + + 8D1F73D41BA66AE50040D369 + + primary + + + 8D1F73DF1BA66AE50040D369 + + primary + + + + + diff --git a/PickAPic/PickAPic/Base.lproj/Main.storyboard b/PickAPic/PickAPic/Base.lproj/Main.storyboard index f055f71..9899545 100644 --- a/PickAPic/PickAPic/Base.lproj/Main.storyboard +++ b/PickAPic/PickAPic/Base.lproj/Main.storyboard @@ -1,10 +1,26 @@ - + - + + + + + + + + + + + + + + + + + @@ -16,12 +32,45 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - + diff --git a/PickAPic/PickAPic/ViewController.h b/PickAPic/PickAPic/ViewController.h index dee0930..07dad00 100644 --- a/PickAPic/PickAPic/ViewController.h +++ b/PickAPic/PickAPic/ViewController.h @@ -8,7 +8,11 @@ #import -@interface ViewController : UIViewController +@interface ViewController : UIViewController + +@property BOOL newMedia; +@property (strong, nonatomic) IBOutlet UIImageView *imageView; + @end diff --git a/PickAPic/PickAPic/ViewController.m b/PickAPic/PickAPic/ViewController.m index acd6613..3606199 100644 --- a/PickAPic/PickAPic/ViewController.m +++ b/PickAPic/PickAPic/ViewController.m @@ -9,10 +9,96 @@ #import "ViewController.h" @interface ViewController () - @end @implementation ViewController +#pragma mark - Camera and Camera Roll + +- (void)alertTheViewAboutCamera { + + UIAlertView *alert = [[UIAlertView alloc]initWithTitle:@"Error" + message:@"No camera found" + delegate:self + cancelButtonTitle:@"OK" + otherButtonTitles:nil]; + + [alert show]; +} + +- (IBAction)camera:(id)sender { + + if ([UIImagePickerController isSourceTypeAvailable: + UIImagePickerControllerSourceTypeCamera]) { + + UIImagePickerController *imagePicker = [[UIImagePickerController alloc] init]; + imagePicker.delegate = self; + imagePicker.sourceType = UIImagePickerControllerSourceTypeCamera; + imagePicker.allowsEditing = NO; + [self presentViewController:imagePicker + animated:YES completion:nil]; + self.newMedia = YES; + } + + else { + [self alertTheViewAboutCamera]; + } + +} + +- (IBAction)cameraRoll:(id)sender { + if ([UIImagePickerController isSourceTypeAvailable: + UIImagePickerControllerSourceTypeSavedPhotosAlbum]) + { + UIImagePickerController *imagePicker = [[UIImagePickerController alloc] init]; + imagePicker.delegate = self; + imagePicker.sourceType = UIImagePickerControllerSourceTypePhotoLibrary; + imagePicker.allowsEditing = NO; + [self presentViewController:imagePicker + animated:YES completion:nil]; + self.newMedia = NO; + } +} + +#pragma mark UIImagePickerControllerDelegate + +-(void)imagePickerController:(UIImagePickerController *)picker +didFinishPickingMediaWithInfo:(NSDictionary *)info +{ + + [self dismissViewControllerAnimated:YES completion:nil]; + + UIImage *image = info[UIImagePickerControllerOriginalImage]; + + self.imageView.image = image; + if (self.newMedia) + UIImageWriteToSavedPhotosAlbum(image, + self, + @selector(image:finishedSavingWithError:contextInfo:), + nil); +} + + + + +-(void)image:(UIImage *)image +finishedSavingWithError:(NSError *)error + contextInfo:(void *)contextInfo +{ + if (error) { + UIAlertView *alert = [[UIAlertView alloc] + initWithTitle: @"Save failed" + message: @"Failed to save image" + delegate: nil + cancelButtonTitle:@"OK" + otherButtonTitles:nil]; + [alert show]; + } +} + +-(void)imagePickerControllerDidCancel:(UIImagePickerController *)picker +{ + [self dismissViewControllerAnimated:YES completion:nil]; +} @end