diff --git a/PartTwo/PartTwo.xcodeproj/project.pbxproj b/PartTwo/PartTwo.xcodeproj/project.pbxproj index 5582517..ecd29dd 100644 --- a/PartTwo/PartTwo.xcodeproj/project.pbxproj +++ b/PartTwo/PartTwo.xcodeproj/project.pbxproj @@ -7,6 +7,7 @@ objects = { /* Begin PBXBuildFile section */ + 8932E2FA1BACDE370028A720 /* SocialMediaView.m in Sources */ = {isa = PBXBuildFile; fileRef = 8932E2F91BACDE370028A720 /* SocialMediaView.m */; settings = {ASSET_TAGS = (); }; }; 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 */; }; @@ -35,6 +36,9 @@ /* End PBXContainerItemProxy section */ /* Begin PBXFileReference section */ + 8932E2F71BACDE1B0028A720 /* protocol.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = protocol.h; sourceTree = ""; }; + 8932E2F81BACDE370028A720 /* SocialMediaView.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SocialMediaView.h; sourceTree = ""; }; + 8932E2F91BACDE370028A720 /* SocialMediaView.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = SocialMediaView.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 = ""; }; @@ -105,6 +109,9 @@ 8DD1034B1BA66E0900CE483B /* AppDelegate.m */, 8DD1034D1BA66E0900CE483B /* ViewController.h */, 8DD1034E1BA66E0900CE483B /* ViewController.m */, + 8932E2F81BACDE370028A720 /* SocialMediaView.h */, + 8932E2F91BACDE370028A720 /* SocialMediaView.m */, + 8932E2F71BACDE1B0028A720 /* protocol.h */, 8DD103501BA66E0900CE483B /* Main.storyboard */, 8DD103531BA66E0900CE483B /* Assets.xcassets */, 8DD103551BA66E0900CE483B /* LaunchScreen.storyboard */, @@ -272,6 +279,7 @@ files = ( 8DD1034F1BA66E0900CE483B /* ViewController.m in Sources */, 8DD1034C1BA66E0900CE483B /* AppDelegate.m in Sources */, + 8932E2FA1BACDE370028A720 /* SocialMediaView.m in Sources */, 8DD103491BA66E0900CE483B /* main.m in Sources */, ); runOnlyForDeploymentPostprocessing = 0; @@ -498,6 +506,7 @@ 8DD103731BA66E0900CE483B /* Release */, ); defaultConfigurationIsVisible = 0; + defaultConfigurationName = Release; }; 8DD103741BA66E0900CE483B /* Build configuration list for PBXNativeTarget "PartTwoTests" */ = { isa = XCConfigurationList; @@ -506,6 +515,7 @@ 8DD103761BA66E0900CE483B /* Release */, ); defaultConfigurationIsVisible = 0; + defaultConfigurationName = Release; }; 8DD103771BA66E0900CE483B /* Build configuration list for PBXNativeTarget "PartTwoUITests" */ = { isa = XCConfigurationList; @@ -514,6 +524,7 @@ 8DD103791BA66E0900CE483B /* Release */, ); defaultConfigurationIsVisible = 0; + defaultConfigurationName = Release; }; /* End XCConfigurationList section */ }; diff --git a/PartTwo/PartTwo.xcodeproj/project.xcworkspace/xcuserdata/Lauren.xcuserdatad/UserInterfaceState.xcuserstate b/PartTwo/PartTwo.xcodeproj/project.xcworkspace/xcuserdata/Lauren.xcuserdatad/UserInterfaceState.xcuserstate new file mode 100644 index 0000000..32b44f0 Binary files /dev/null and b/PartTwo/PartTwo.xcodeproj/project.xcworkspace/xcuserdata/Lauren.xcuserdatad/UserInterfaceState.xcuserstate differ diff --git a/PartTwo/PartTwo.xcodeproj/xcuserdata/Lauren.xcuserdatad/xcschemes/PartTwo.xcscheme b/PartTwo/PartTwo.xcodeproj/xcuserdata/Lauren.xcuserdatad/xcschemes/PartTwo.xcscheme new file mode 100644 index 0000000..7b83b68 --- /dev/null +++ b/PartTwo/PartTwo.xcodeproj/xcuserdata/Lauren.xcuserdatad/xcschemes/PartTwo.xcscheme @@ -0,0 +1,111 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/PartTwo/PartTwo.xcodeproj/xcuserdata/Lauren.xcuserdatad/xcschemes/xcschememanagement.plist b/PartTwo/PartTwo.xcodeproj/xcuserdata/Lauren.xcuserdatad/xcschemes/xcschememanagement.plist new file mode 100644 index 0000000..8d9c097 --- /dev/null +++ b/PartTwo/PartTwo.xcodeproj/xcuserdata/Lauren.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/Base.lproj/Main.storyboard b/PartTwo/PartTwo/Base.lproj/Main.storyboard index f56d2f3..7c3f1df 100644 --- a/PartTwo/PartTwo/Base.lproj/Main.storyboard +++ b/PartTwo/PartTwo/Base.lproj/Main.storyboard @@ -1,13 +1,14 @@ - + - + + - + @@ -15,8 +16,54 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/PartTwo/PartTwo/SocialMediaView.h b/PartTwo/PartTwo/SocialMediaView.h new file mode 100644 index 0000000..33cfd7f --- /dev/null +++ b/PartTwo/PartTwo/SocialMediaView.h @@ -0,0 +1,17 @@ +// +// SocialMediaView.h +// PartTwo +// +// Created by Lauren Caponong on 9/18/15. +// Copyright © 2015 Mike Kavouras. All rights reserved. +// + +#import +#import "protocol.h" + + +@interface SocialMediaView : UIView + +@property (nonatomic, weak) id delegate; + +@end diff --git a/PartTwo/PartTwo/SocialMediaView.m b/PartTwo/PartTwo/SocialMediaView.m new file mode 100644 index 0000000..f5e4ca5 --- /dev/null +++ b/PartTwo/PartTwo/SocialMediaView.m @@ -0,0 +1,26 @@ +// +// SocialMediaView.m +// PartTwo +// +// Created by Lauren Caponong on 9/18/15. +// Copyright © 2015 Mike Kavouras. All rights reserved. +// + +#import "SocialMediaView.h" + + +@implementation SocialMediaView + +- (IBAction)likeButtonTapped:(UIButton *)sender { + [self.delegate socialMediaViewDidTapLikeButton:self]; +} + +- (IBAction)commentButtonTapped:(UIButton *)sender { + [self.delegate socialMediaViewDidTapCommentButton:self]; +} + +- (IBAction)shareButtonTapped:(UIButton *)sender { + [self.delegate socialMediaViewDidTapShareButton:self]; +} + +@end \ No newline at end of file diff --git a/PartTwo/PartTwo/ViewController.m b/PartTwo/PartTwo/ViewController.m index adca251..a2c5756 100644 --- a/PartTwo/PartTwo/ViewController.m +++ b/PartTwo/PartTwo/ViewController.m @@ -7,21 +7,44 @@ // #import "ViewController.h" +#import "protocol.h" +#import "SocialMediaView.h" -@interface ViewController () +@interface ViewController () + +@property (weak, nonatomic) IBOutlet SocialMediaView *SocialMediaView; @end + + @implementation ViewController - (void)viewDidLoad { [super viewDidLoad]; - // Do any additional setup after loading the view, typically from a nib. + + self.SocialMediaView.delegate = self; + +} + + +- (void)socialMediaViewDidTapLikeButton:(SocialMediaView *)view { + + self.view.backgroundColor = [UIColor blueColor]; + NSLog(@"You like this"); +} + + +- (void)socialMediaViewDidTapCommentButton:(SocialMediaView *)view { + + self.view.backgroundColor = [UIColor greenColor]; + NSLog(@"You comment on this"); } -- (void)didReceiveMemoryWarning { - [super didReceiveMemoryWarning]; - // Dispose of any resources that can be recreated. +- (void)socialMediaViewDidTapShareButton:(SocialMediaView *)view { + + self.view.backgroundColor = [UIColor purpleColor]; + NSLog(@"You share this!"); } @end diff --git a/PartTwo/PartTwo/protocol.h b/PartTwo/PartTwo/protocol.h new file mode 100644 index 0000000..8fe9316 --- /dev/null +++ b/PartTwo/PartTwo/protocol.h @@ -0,0 +1,19 @@ +// +// protocol.h +// PartTwo +// +// Created by Lauren Caponong on 9/18/15. +// Copyright © 2015 Mike Kavouras. All rights reserved. +// + +#import + +@class SocialMediaView; + +@protocol protocol + +- (void)socialMediaViewDidTapLikeButton:(SocialMediaView *)view; +- (void)socialMediaViewDidTapCommentButton:(SocialMediaView *)view; +- (void)socialMediaViewDidTapShareButton:(SocialMediaView *)view; + +@end diff --git a/PickAPic/PickAPic.xcodeproj/project.xcworkspace/xcuserdata/Lauren.xcuserdatad/UserInterfaceState.xcuserstate b/PickAPic/PickAPic.xcodeproj/project.xcworkspace/xcuserdata/Lauren.xcuserdatad/UserInterfaceState.xcuserstate new file mode 100644 index 0000000..accd334 Binary files /dev/null and b/PickAPic/PickAPic.xcodeproj/project.xcworkspace/xcuserdata/Lauren.xcuserdatad/UserInterfaceState.xcuserstate differ diff --git a/PickAPic/PickAPic.xcodeproj/xcuserdata/Lauren.xcuserdatad/xcschemes/PickAPic.xcscheme b/PickAPic/PickAPic.xcodeproj/xcuserdata/Lauren.xcuserdatad/xcschemes/PickAPic.xcscheme new file mode 100644 index 0000000..72d7729 --- /dev/null +++ b/PickAPic/PickAPic.xcodeproj/xcuserdata/Lauren.xcuserdatad/xcschemes/PickAPic.xcscheme @@ -0,0 +1,111 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/PickAPic/PickAPic.xcodeproj/xcuserdata/Lauren.xcuserdatad/xcschemes/xcschememanagement.plist b/PickAPic/PickAPic.xcodeproj/xcuserdata/Lauren.xcuserdatad/xcschemes/xcschememanagement.plist new file mode 100644 index 0000000..bb91a10 --- /dev/null +++ b/PickAPic/PickAPic.xcodeproj/xcuserdata/Lauren.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..0643992 100644 --- a/PickAPic/PickAPic/Base.lproj/Main.storyboard +++ b/PickAPic/PickAPic/Base.lproj/Main.storyboard @@ -1,5 +1,5 @@ - + @@ -16,8 +16,44 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/PickAPic/PickAPic/ViewController.h b/PickAPic/PickAPic/ViewController.h index dee0930..b723aff 100644 --- a/PickAPic/PickAPic/ViewController.h +++ b/PickAPic/PickAPic/ViewController.h @@ -8,8 +8,9 @@ #import -@interface ViewController : UIViewController +@interface ViewController : UIViewController +@property (weak, nonatomic) IBOutlet UIImageView *imageView; @end diff --git a/PickAPic/PickAPic/ViewController.m b/PickAPic/PickAPic/ViewController.m index acd6613..b5af7ab 100644 --- a/PickAPic/PickAPic/ViewController.m +++ b/PickAPic/PickAPic/ViewController.m @@ -12,7 +12,41 @@ @interface ViewController () @end + + + @implementation ViewController +- (IBAction)cameraRollButtonTapped:(UIButton *)sender { + + UIImagePickerController *picker = [[UIImagePickerController alloc] init]; + + picker.delegate = self; + + picker.allowsEditing = YES; + + picker.sourceType = UIImagePickerControllerSourceTypePhotoLibrary; + + [self presentViewController:picker animated:YES completion:NULL]; + +} + + +- (void)imagePickerController:(UIImagePickerController *)picker didFinishPickingMediaWithInfo:(NSDictionary *)info { + + UIImage *pickedImage = info[UIImagePickerControllerEditedImage]; + + self.imageView.image = pickedImage; + + [picker dismissViewControllerAnimated:YES completion:NULL]; + +} + + +- (void)imagePickerControllerDidCancel:(UIImagePickerController *)picker { + + [picker dismissViewControllerAnimated:YES completion:NULL]; +} + @end