diff --git a/PartTwo/.DS_Store b/PartTwo/.DS_Store new file mode 100644 index 0000000..2d97894 Binary files /dev/null and b/PartTwo/.DS_Store differ diff --git a/PartTwo/PartTwo.xcodeproj/project.pbxproj b/PartTwo/PartTwo.xcodeproj/project.pbxproj index 5582517..eb38cdc 100644 --- a/PartTwo/PartTwo.xcodeproj/project.pbxproj +++ b/PartTwo/PartTwo.xcodeproj/project.pbxproj @@ -15,6 +15,7 @@ 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 */; }; + D9E987E41BA9C2F100DD7F6D /* SocialMediaView.m in Sources */ = {isa = PBXBuildFile; fileRef = D9E987E31BA9C2F100DD7F6D /* SocialMediaView.m */; settings = {ASSET_TAGS = (); }; }; /* End PBXBuildFile section */ /* Begin PBXContainerItemProxy section */ @@ -51,6 +52,9 @@ 8DD103681BA66E0900CE483B /* PartTwoUITests.xctest */ = {isa = PBXFileReference; explicitFileType = wrapper.cfbundle; includeInIndex = 0; path = PartTwoUITests.xctest; sourceTree = BUILT_PRODUCTS_DIR; }; 8DD1036C1BA66E0900CE483B /* PartTwoUITests.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = PartTwoUITests.m; sourceTree = ""; }; 8DD1036E1BA66E0900CE483B /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = ""; }; + D9E987E21BA9C2F100DD7F6D /* SocialMediaView.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SocialMediaView.h; sourceTree = ""; }; + D9E987E31BA9C2F100DD7F6D /* SocialMediaView.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = SocialMediaView.m; sourceTree = ""; }; + D9E987E51BA9C56500DD7F6D /* SocialMediaViewDelegate.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SocialMediaViewDelegate.h; sourceTree = ""; }; /* End PBXFileReference section */ /* Begin PBXFrameworksBuildPhase section */ @@ -105,6 +109,9 @@ 8DD1034B1BA66E0900CE483B /* AppDelegate.m */, 8DD1034D1BA66E0900CE483B /* ViewController.h */, 8DD1034E1BA66E0900CE483B /* ViewController.m */, + D9E987E21BA9C2F100DD7F6D /* SocialMediaView.h */, + D9E987E31BA9C2F100DD7F6D /* SocialMediaView.m */, + D9E987E51BA9C56500DD7F6D /* SocialMediaViewDelegate.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 */, + D9E987E41BA9C2F100DD7F6D /* 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/xiulan.xcuserdatad/UserInterfaceState.xcuserstate b/PartTwo/PartTwo.xcodeproj/project.xcworkspace/xcuserdata/xiulan.xcuserdatad/UserInterfaceState.xcuserstate new file mode 100644 index 0000000..87c4311 Binary files /dev/null and b/PartTwo/PartTwo.xcodeproj/project.xcworkspace/xcuserdata/xiulan.xcuserdatad/UserInterfaceState.xcuserstate differ diff --git a/PartTwo/PartTwo.xcodeproj/xcuserdata/xiulan.xcuserdatad/xcdebugger/Breakpoints_v2.xcbkptlist b/PartTwo/PartTwo.xcodeproj/xcuserdata/xiulan.xcuserdatad/xcdebugger/Breakpoints_v2.xcbkptlist new file mode 100644 index 0000000..fe2b454 --- /dev/null +++ b/PartTwo/PartTwo.xcodeproj/xcuserdata/xiulan.xcuserdatad/xcdebugger/Breakpoints_v2.xcbkptlist @@ -0,0 +1,5 @@ + + + diff --git a/PartTwo/PartTwo.xcodeproj/xcuserdata/xiulan.xcuserdatad/xcschemes/PartTwo.xcscheme b/PartTwo/PartTwo.xcodeproj/xcuserdata/xiulan.xcuserdatad/xcschemes/PartTwo.xcscheme new file mode 100644 index 0000000..7b83b68 --- /dev/null +++ b/PartTwo/PartTwo.xcodeproj/xcuserdata/xiulan.xcuserdatad/xcschemes/PartTwo.xcscheme @@ -0,0 +1,111 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/PartTwo/PartTwo.xcodeproj/xcuserdata/xiulan.xcuserdatad/xcschemes/xcschememanagement.plist b/PartTwo/PartTwo.xcodeproj/xcuserdata/xiulan.xcuserdatad/xcschemes/xcschememanagement.plist new file mode 100644 index 0000000..8d9c097 --- /dev/null +++ b/PartTwo/PartTwo.xcodeproj/xcuserdata/xiulan.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..b26860d 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..3c515fc --- /dev/null +++ b/PartTwo/PartTwo/SocialMediaView.h @@ -0,0 +1,16 @@ +// +// SocialMediaView.h +// PartTwo +// +// Created by Xiulan Shi on 9/16/15. +// Copyright © 2015 Mike Kavouras. All rights reserved. +// + +#import +#import "SocialMediaViewDelegate.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..52ca532 --- /dev/null +++ b/PartTwo/PartTwo/SocialMediaView.m @@ -0,0 +1,28 @@ +// +// SocialMediaView.m +// PartTwo +// +// Created by Xiulan Shi on 9/16/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 diff --git a/PartTwo/PartTwo/SocialMediaViewDelegate.h b/PartTwo/PartTwo/SocialMediaViewDelegate.h new file mode 100644 index 0000000..f64009d --- /dev/null +++ b/PartTwo/PartTwo/SocialMediaViewDelegate.h @@ -0,0 +1,17 @@ +// +// SocialMediaViewDelegate.h +// PartTwo +// +// Created by Xiulan Shi on 9/16/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.m b/PartTwo/PartTwo/ViewController.m index adca251..5455be2 100644 --- a/PartTwo/PartTwo/ViewController.m +++ b/PartTwo/PartTwo/ViewController.m @@ -7,8 +7,12 @@ // #import "ViewController.h" +#import "SocialMediaView.h" +#import "SocialMediaViewDelegate.h" -@interface ViewController () +@interface ViewController () + +@property (weak, nonatomic) IBOutlet SocialMediaView *socialMediaView; @end @@ -16,12 +20,23 @@ @implementation ViewController - (void)viewDidLoad { [super viewDidLoad]; - // Do any additional setup after loading the view, typically from a nib. + + self.socialMediaView.delegate = self; + } -- (void)didReceiveMemoryWarning { - [super didReceiveMemoryWarning]; - // Dispose of any resources that can be recreated. +- (void)socialMediaViewDidTapLikeButton:(SocialMediaView *)view { + + self.view.backgroundColor = [UIColor blueColor]; + +} +- (void)socialMediaViewDidTapCommentButton:(SocialMediaView *)view { + + self.view.backgroundColor = [UIColor greenColor]; + +} +- (void)socialMediaViewDidTapShareButton:(SocialMediaView *)view { + + self.view.backgroundColor = [UIColor redColor]; } - @end diff --git a/PickAPic/.DS_Store b/PickAPic/.DS_Store new file mode 100644 index 0000000..5b879e3 Binary files /dev/null and b/PickAPic/.DS_Store differ diff --git a/PickAPic/PickAPic.xcodeproj/project.xcworkspace/xcuserdata/xiulan.xcuserdatad/UserInterfaceState.xcuserstate b/PickAPic/PickAPic.xcodeproj/project.xcworkspace/xcuserdata/xiulan.xcuserdatad/UserInterfaceState.xcuserstate new file mode 100644 index 0000000..20c34b2 Binary files /dev/null and b/PickAPic/PickAPic.xcodeproj/project.xcworkspace/xcuserdata/xiulan.xcuserdatad/UserInterfaceState.xcuserstate differ diff --git a/PickAPic/PickAPic.xcodeproj/xcuserdata/xiulan.xcuserdatad/xcschemes/PickAPic.xcscheme b/PickAPic/PickAPic.xcodeproj/xcuserdata/xiulan.xcuserdatad/xcschemes/PickAPic.xcscheme new file mode 100644 index 0000000..72d7729 --- /dev/null +++ b/PickAPic/PickAPic.xcodeproj/xcuserdata/xiulan.xcuserdatad/xcschemes/PickAPic.xcscheme @@ -0,0 +1,111 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/PickAPic/PickAPic.xcodeproj/xcuserdata/xiulan.xcuserdatad/xcschemes/xcschememanagement.plist b/PickAPic/PickAPic.xcodeproj/xcuserdata/xiulan.xcuserdatad/xcschemes/xcschememanagement.plist new file mode 100644 index 0000000..bb91a10 --- /dev/null +++ b/PickAPic/PickAPic.xcodeproj/xcuserdata/xiulan.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..ca7e8c2 100644 --- a/PickAPic/PickAPic/Base.lproj/Main.storyboard +++ b/PickAPic/PickAPic/Base.lproj/Main.storyboard @@ -1,5 +1,5 @@ - + @@ -16,8 +16,31 @@ + + + + + + + + + + + + + + + + + diff --git a/PickAPic/PickAPic/ViewController.m b/PickAPic/PickAPic/ViewController.m index acd6613..4436486 100644 --- a/PickAPic/PickAPic/ViewController.m +++ b/PickAPic/PickAPic/ViewController.m @@ -8,11 +8,31 @@ #import "ViewController.h" -@interface ViewController () +@interface ViewController () +@property (weak, nonatomic) IBOutlet UIImageView *imageView; +@property (nonatomic) UIImagePickerController *picker; +@property (nonatomic,weak) UIImage *image; @end @implementation ViewController +- (IBAction)cameraRollButtonTapped:(UIButton *)sender { + self.picker = [[UIImagePickerController alloc] init]; + self.picker.delegate = self; + [self.picker setSourceType:UIImagePickerControllerSourceTypePhotoLibrary]; + [self presentViewController:self.picker animated:YES completion:NULL]; + +} + +- (void)imagePickerController:(UIImagePickerController *)picker didFinishPickingMediaWithInfo:(NSDictionary *)info{ + self.image = [info objectForKey:UIImagePickerControllerOriginalImage]; + [self.imageView setImage:self.image]; + [self dismissViewControllerAnimated:YES completion:NULL]; +} + +- (void)imagePickerControllerDidCancel:(UIImagePickerController *)picker { + [self dismissViewControllerAnimated:YES completion:NULL]; +} @end