diff --git a/PartTwo/PartTwo.xcodeproj/project.pbxproj b/PartTwo/PartTwo.xcodeproj/project.pbxproj index 5582517..9975cba 100644 --- a/PartTwo/PartTwo.xcodeproj/project.pbxproj +++ b/PartTwo/PartTwo.xcodeproj/project.pbxproj @@ -7,6 +7,7 @@ objects = { /* Begin PBXBuildFile section */ + 690DE2B01BABDBFF003B045F /* SocialMediaView.m in Sources */ = {isa = PBXBuildFile; fileRef = 690DE2AF1BABDBFF003B045F /* 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 */ + 690DE2AE1BABDBFF003B045F /* SocialMediaView.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SocialMediaView.h; sourceTree = ""; }; + 690DE2AF1BABDBFF003B045F /* SocialMediaView.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = SocialMediaView.m; sourceTree = ""; }; + 690DE2B21BABE04A003B045F /* SocialMediaViewProtocol.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SocialMediaViewProtocol.h; 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 = ""; }; @@ -103,8 +107,11 @@ children = ( 8DD1034A1BA66E0900CE483B /* AppDelegate.h */, 8DD1034B1BA66E0900CE483B /* AppDelegate.m */, + 690DE2B21BABE04A003B045F /* SocialMediaViewProtocol.h */, 8DD1034D1BA66E0900CE483B /* ViewController.h */, 8DD1034E1BA66E0900CE483B /* ViewController.m */, + 690DE2AE1BABDBFF003B045F /* SocialMediaView.h */, + 690DE2AF1BABDBFF003B045F /* SocialMediaView.m */, 8DD103501BA66E0900CE483B /* Main.storyboard */, 8DD103531BA66E0900CE483B /* Assets.xcassets */, 8DD103551BA66E0900CE483B /* LaunchScreen.storyboard */, @@ -272,6 +279,7 @@ files = ( 8DD1034F1BA66E0900CE483B /* ViewController.m in Sources */, 8DD1034C1BA66E0900CE483B /* AppDelegate.m in Sources */, + 690DE2B01BABDBFF003B045F /* 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/ThePro.xcuserdatad/UserInterfaceState.xcuserstate b/PartTwo/PartTwo.xcodeproj/project.xcworkspace/xcuserdata/ThePro.xcuserdatad/UserInterfaceState.xcuserstate new file mode 100644 index 0000000..37a2056 Binary files /dev/null and b/PartTwo/PartTwo.xcodeproj/project.xcworkspace/xcuserdata/ThePro.xcuserdatad/UserInterfaceState.xcuserstate differ diff --git a/PartTwo/PartTwo.xcodeproj/xcuserdata/ThePro.xcuserdatad/xcdebugger/Breakpoints_v2.xcbkptlist b/PartTwo/PartTwo.xcodeproj/xcuserdata/ThePro.xcuserdatad/xcdebugger/Breakpoints_v2.xcbkptlist new file mode 100644 index 0000000..fe2b454 --- /dev/null +++ b/PartTwo/PartTwo.xcodeproj/xcuserdata/ThePro.xcuserdatad/xcdebugger/Breakpoints_v2.xcbkptlist @@ -0,0 +1,5 @@ + + + diff --git a/PartTwo/PartTwo.xcodeproj/xcuserdata/ThePro.xcuserdatad/xcschemes/PartTwo.xcscheme b/PartTwo/PartTwo.xcodeproj/xcuserdata/ThePro.xcuserdatad/xcschemes/PartTwo.xcscheme new file mode 100644 index 0000000..7b83b68 --- /dev/null +++ b/PartTwo/PartTwo.xcodeproj/xcuserdata/ThePro.xcuserdatad/xcschemes/PartTwo.xcscheme @@ -0,0 +1,111 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/PartTwo/PartTwo.xcodeproj/xcuserdata/ThePro.xcuserdatad/xcschemes/xcschememanagement.plist b/PartTwo/PartTwo.xcodeproj/xcuserdata/ThePro.xcuserdatad/xcschemes/xcschememanagement.plist new file mode 100644 index 0000000..8d9c097 --- /dev/null +++ b/PartTwo/PartTwo.xcodeproj/xcuserdata/ThePro.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/LaunchScreen.storyboard b/PartTwo/PartTwo/Base.lproj/LaunchScreen.storyboard index 2e721e1..aa08113 100644 --- a/PartTwo/PartTwo/Base.lproj/LaunchScreen.storyboard +++ b/PartTwo/PartTwo/Base.lproj/LaunchScreen.storyboard @@ -1,7 +1,8 @@ - + - + + diff --git a/PartTwo/PartTwo/Base.lproj/Main.storyboard b/PartTwo/PartTwo/Base.lproj/Main.storyboard index f56d2f3..6cebb29 100644 --- a/PartTwo/PartTwo/Base.lproj/Main.storyboard +++ b/PartTwo/PartTwo/Base.lproj/Main.storyboard @@ -1,13 +1,15 @@ - + - + + + - + @@ -15,11 +17,109 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/PartTwo/PartTwo/SocialMediaView.h b/PartTwo/PartTwo/SocialMediaView.h new file mode 100644 index 0000000..b707ab7 --- /dev/null +++ b/PartTwo/PartTwo/SocialMediaView.h @@ -0,0 +1,18 @@ +// +// SocialMediaView.h +// PartTwo +// +// Created by Z on 9/18/15. +// Copyright © 2015 Mike Kavouras. All rights reserved. +// + +#import +#import "SocialMediaViewProtocol.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..1b6211c --- /dev/null +++ b/PartTwo/PartTwo/SocialMediaView.m @@ -0,0 +1,29 @@ +// +// SocialMediaView.m +// PartTwo +// +// Created by Z on 9/18/15. +// Copyright © 2015 Mike Kavouras. All rights reserved. +// + +#import "SocialMediaView.h" + +@interface SocialMediaView() + +@end + +@implementation SocialMediaView + +- (IBAction)likeButtonPressed{ + [self.delegate socialMediaViewDidTapLikeButton:self]; +} + +- (IBAction)commentButtonPressed{ + [self.delegate socialMediaViewDidTapCommentButton:self]; +} + +- (IBAction)shareButtonPressed{ + [self.delegate socialMediaViewDidTapShareButton:self]; +} + +@end \ No newline at end of file diff --git a/PartTwo/PartTwo/SocialMediaViewProrocol.h b/PartTwo/PartTwo/SocialMediaViewProrocol.h new file mode 100644 index 0000000..cb5d316 --- /dev/null +++ b/PartTwo/PartTwo/SocialMediaViewProrocol.h @@ -0,0 +1,13 @@ +// +// SocialMediaViewProrocol.h +// PartTwo +// +// Created by Z on 9/18/15. +// Copyright © 2015 Mike Kavouras. All rights reserved. +// + +#import + +@protocol SocialMediaViewProrocol + +@end diff --git a/PartTwo/PartTwo/SocialMediaViewProtocol.h b/PartTwo/PartTwo/SocialMediaViewProtocol.h new file mode 100644 index 0000000..8745693 --- /dev/null +++ b/PartTwo/PartTwo/SocialMediaViewProtocol.h @@ -0,0 +1,19 @@ +// +// SocialMediaViewProtocol.h +// PartTwo +// +// Created by Z on 9/18/15. +// Copyright © 2015 Mike Kavouras. All rights reserved. +// + +#import + +@class SocialMediaView; + +@protocol SocialMediaViewDelegate + +- (void)socialMediaViewDidTapLikeButton:(SocialMediaView *)view; +- (void)socialMediaViewDidTapCommentButton:(SocialMediaView *)view; +- (void)socialMediaViewDidTapShareButton:(SocialMediaView *)view; + +@end diff --git a/PartTwo/PartTwo/ViewController.h b/PartTwo/PartTwo/ViewController.h index cb5d98b..75f9d3a 100644 --- a/PartTwo/PartTwo/ViewController.h +++ b/PartTwo/PartTwo/ViewController.h @@ -10,6 +10,5 @@ @interface ViewController : UIViewController - @end diff --git a/PartTwo/PartTwo/ViewController.m b/PartTwo/PartTwo/ViewController.m index adca251..e6d6a8b 100644 --- a/PartTwo/PartTwo/ViewController.m +++ b/PartTwo/PartTwo/ViewController.m @@ -7,8 +7,12 @@ // #import "ViewController.h" +#import "SocialMediaView.h" +#import "SocialMediaViewProtocol.h" -@interface ViewController () +@interface ViewController () + +@property (weak, nonatomic) IBOutlet SocialMediaView *socialMediaView; @end @@ -16,12 +20,21 @@ @implementation ViewController - (void)viewDidLoad { [super viewDidLoad]; - // Do any additional setup after loading the view, typically from a nib. + self.socialMediaView.delegate = self; +} + +#pragma mark - delegate methods + +-(void)socialMediaViewDidTapLikeButton:(SocialMediaView *)view{ + self.view.backgroundColor = [UIColor blueColor]; +} + +-(void)socialMediaViewDidTapCommentButton:(SocialMediaView *)view{ + self.view.backgroundColor = [UIColor greenColor]; } -- (void)didReceiveMemoryWarning { - [super didReceiveMemoryWarning]; - // Dispose of any resources that can be recreated. +-(void)socialMediaViewDidTapShareButton:(SocialMediaView *)view{ + self.view.backgroundColor = [UIColor redColor]; } @end diff --git a/PickAPic/PickAPic.xcodeproj/project.pbxproj b/PickAPic/PickAPic.xcodeproj/project.pbxproj index 049896b..95ad8fc 100644 --- a/PickAPic/PickAPic.xcodeproj/project.pbxproj +++ b/PickAPic/PickAPic.xcodeproj/project.pbxproj @@ -7,6 +7,8 @@ objects = { /* Begin PBXBuildFile section */ + 690DE2AD1BABD7BD003B045F /* ImagePickerController.m in Sources */ = {isa = PBXBuildFile; fileRef = 690DE2AC1BABD7BD003B045F /* ImagePickerController.m */; settings = {ASSET_TAGS = (); }; }; + 6947DFD71BABD1A400421CAF /* MobileCoreServices.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 6947DFD61BABD1A400421CAF /* MobileCoreServices.framework */; }; 8D1F73C11BA66AE50040D369 /* main.m in Sources */ = {isa = PBXBuildFile; fileRef = 8D1F73C01BA66AE50040D369 /* main.m */; }; 8D1F73C41BA66AE50040D369 /* AppDelegate.m in Sources */ = {isa = PBXBuildFile; fileRef = 8D1F73C31BA66AE50040D369 /* AppDelegate.m */; }; 8D1F73C71BA66AE50040D369 /* ViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = 8D1F73C61BA66AE50040D369 /* ViewController.m */; }; @@ -35,6 +37,9 @@ /* End PBXContainerItemProxy section */ /* Begin PBXFileReference section */ + 690DE2AB1BABD7BD003B045F /* ImagePickerController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ImagePickerController.h; sourceTree = ""; }; + 690DE2AC1BABD7BD003B045F /* ImagePickerController.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = ImagePickerController.m; sourceTree = ""; }; + 6947DFD61BABD1A400421CAF /* MobileCoreServices.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = MobileCoreServices.framework; path = System/Library/Frameworks/MobileCoreServices.framework; sourceTree = SDKROOT; }; 8D1F73BC1BA66AE50040D369 /* PickAPic.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = PickAPic.app; sourceTree = BUILT_PRODUCTS_DIR; }; 8D1F73C01BA66AE50040D369 /* main.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = main.m; sourceTree = ""; }; 8D1F73C21BA66AE50040D369 /* AppDelegate.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = AppDelegate.h; sourceTree = ""; }; @@ -58,6 +63,7 @@ isa = PBXFrameworksBuildPhase; buildActionMask = 2147483647; files = ( + 6947DFD71BABD1A400421CAF /* MobileCoreServices.framework in Frameworks */, ); runOnlyForDeploymentPostprocessing = 0; }; @@ -81,6 +87,7 @@ 8D1F73B31BA66AE50040D369 = { isa = PBXGroup; children = ( + 6947DFD61BABD1A400421CAF /* MobileCoreServices.framework */, 8D1F73BE1BA66AE50040D369 /* PickAPic */, 8D1F73D81BA66AE50040D369 /* PickAPicTests */, 8D1F73E31BA66AE50040D369 /* PickAPicUITests */, @@ -105,6 +112,8 @@ 8D1F73C31BA66AE50040D369 /* AppDelegate.m */, 8D1F73C51BA66AE50040D369 /* ViewController.h */, 8D1F73C61BA66AE50040D369 /* ViewController.m */, + 690DE2AB1BABD7BD003B045F /* ImagePickerController.h */, + 690DE2AC1BABD7BD003B045F /* ImagePickerController.m */, 8D1F73C81BA66AE50040D369 /* Main.storyboard */, 8D1F73CB1BA66AE50040D369 /* Assets.xcassets */, 8D1F73CD1BA66AE50040D369 /* LaunchScreen.storyboard */, @@ -273,6 +282,7 @@ 8D1F73C71BA66AE50040D369 /* ViewController.m in Sources */, 8D1F73C41BA66AE50040D369 /* AppDelegate.m in Sources */, 8D1F73C11BA66AE50040D369 /* main.m in Sources */, + 690DE2AD1BABD7BD003B045F /* ImagePickerController.m in Sources */, ); runOnlyForDeploymentPostprocessing = 0; }; diff --git a/PickAPic/PickAPic.xcodeproj/project.xcworkspace/xcuserdata/ThePro.xcuserdatad/UserInterfaceState.xcuserstate b/PickAPic/PickAPic.xcodeproj/project.xcworkspace/xcuserdata/ThePro.xcuserdatad/UserInterfaceState.xcuserstate new file mode 100644 index 0000000..09163fc Binary files /dev/null and b/PickAPic/PickAPic.xcodeproj/project.xcworkspace/xcuserdata/ThePro.xcuserdatad/UserInterfaceState.xcuserstate differ diff --git a/PickAPic/PickAPic.xcodeproj/xcuserdata/ThePro.xcuserdatad/xcdebugger/Breakpoints_v2.xcbkptlist b/PickAPic/PickAPic.xcodeproj/xcuserdata/ThePro.xcuserdatad/xcdebugger/Breakpoints_v2.xcbkptlist new file mode 100644 index 0000000..fe2b454 --- /dev/null +++ b/PickAPic/PickAPic.xcodeproj/xcuserdata/ThePro.xcuserdatad/xcdebugger/Breakpoints_v2.xcbkptlist @@ -0,0 +1,5 @@ + + + diff --git a/PickAPic/PickAPic.xcodeproj/xcuserdata/ThePro.xcuserdatad/xcschemes/PickAPic.xcscheme b/PickAPic/PickAPic.xcodeproj/xcuserdata/ThePro.xcuserdatad/xcschemes/PickAPic.xcscheme new file mode 100644 index 0000000..72d7729 --- /dev/null +++ b/PickAPic/PickAPic.xcodeproj/xcuserdata/ThePro.xcuserdatad/xcschemes/PickAPic.xcscheme @@ -0,0 +1,111 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/PickAPic/PickAPic.xcodeproj/xcuserdata/ThePro.xcuserdatad/xcschemes/xcschememanagement.plist b/PickAPic/PickAPic.xcodeproj/xcuserdata/ThePro.xcuserdatad/xcschemes/xcschememanagement.plist new file mode 100644 index 0000000..bb91a10 --- /dev/null +++ b/PickAPic/PickAPic.xcodeproj/xcuserdata/ThePro.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/LaunchScreen.storyboard b/PickAPic/PickAPic/Base.lproj/LaunchScreen.storyboard index 2e721e1..5c3ba55 100644 --- a/PickAPic/PickAPic/Base.lproj/LaunchScreen.storyboard +++ b/PickAPic/PickAPic/Base.lproj/LaunchScreen.storyboard @@ -1,7 +1,8 @@ - + - + + @@ -15,8 +16,18 @@ + + + + + + + diff --git a/PickAPic/PickAPic/Base.lproj/Main.storyboard b/PickAPic/PickAPic/Base.lproj/Main.storyboard index f055f71..7f73631 100644 --- a/PickAPic/PickAPic/Base.lproj/Main.storyboard +++ b/PickAPic/PickAPic/Base.lproj/Main.storyboard @@ -1,8 +1,9 @@ - + + @@ -16,8 +17,31 @@ + + + + + + + + + + + + + + + + + diff --git a/PickAPic/PickAPic/ImagePickerController.h b/PickAPic/PickAPic/ImagePickerController.h new file mode 100644 index 0000000..cc3111e --- /dev/null +++ b/PickAPic/PickAPic/ImagePickerController.h @@ -0,0 +1,13 @@ +// +// ImagePickerController.h +// PickAPic +// +// Created by Z on 9/18/15. +// Copyright © 2015 Mike Kavouras. All rights reserved. +// + +#import + +@interface ImagePickerController : UIImagePickerController + +@end diff --git a/PickAPic/PickAPic/ImagePickerController.m b/PickAPic/PickAPic/ImagePickerController.m new file mode 100644 index 0000000..224ba0c --- /dev/null +++ b/PickAPic/PickAPic/ImagePickerController.m @@ -0,0 +1,37 @@ +// +// ImagePickerController.m +// PickAPic +// +// Created by Z on 9/18/15. +// Copyright © 2015 Mike Kavouras. All rights reserved. +// + +#import "ImagePickerController.h" + +@interface ImagePickerController () + +@end + +@implementation ImagePickerController + +- (void)viewDidLoad { + [super viewDidLoad]; + // Do any additional setup after loading the view. +} + +- (void)didReceiveMemoryWarning { + [super didReceiveMemoryWarning]; + // Dispose of any resources that can be recreated. +} + +/* +#pragma mark - Navigation + +// In a storyboard-based application, you will often want to do a little preparation before navigation +- (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender { + // Get the new view controller using [segue destinationViewController]. + // Pass the selected object to the new view controller. +} +*/ + +@end diff --git a/PickAPic/PickAPic/ViewController.m b/PickAPic/PickAPic/ViewController.m index acd6613..ec4d8db 100644 --- a/PickAPic/PickAPic/ViewController.m +++ b/PickAPic/PickAPic/ViewController.m @@ -7,12 +7,47 @@ // #import "ViewController.h" +#import -@interface ViewController () +@interface ViewController () + +@property (nonatomic) UIImagePickerController *imagePickerController; +@property (weak, nonatomic) IBOutlet UIImageView *imageView; @end @implementation ViewController +-(void)viewDidLoad{ + [super viewDidLoad]; + [self setupImagePickerController]; +} + +- (void)setupImagePickerController{ + UIImagePickerController *imagePickerController = [[UIImagePickerController alloc] init]; + imagePickerController.modalPresentationStyle = UIModalPresentationCurrentContext; + + if([UIImagePickerController isSourceTypeAvailable:UIImagePickerControllerSourceTypePhotoLibrary ]){ + imagePickerController.sourceType = UIImagePickerControllerSourceTypePhotoLibrary; + } + imagePickerController.delegate = self; + + imagePickerController.mediaTypes = + [[NSArray alloc] initWithObjects: (NSString *) kUTTypeImage, nil]; + + self.imagePickerController = imagePickerController; +} + +- (IBAction)cameraRollButtonTouched:(UIButton *)sender { + [self presentViewController:self.imagePickerController animated:YES completion:nil]; +} + +#pragma mark - UIImagePickerControllerDelegate methods + +-(void)imagePickerController:(UIImagePickerController *)picker didFinishPickingImage:(UIImage *)image editingInfo:(NSDictionary *)editingInfo{ + [self.imageView setImage:image]; + [self dismissViewControllerAnimated:YES completion:nil]; +} + @end