diff --git a/PartTwo/.DS_Store b/PartTwo/.DS_Store new file mode 100644 index 0000000..18d60be 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..0f92e5f 100644 --- a/PartTwo/PartTwo.xcodeproj/project.pbxproj +++ b/PartTwo/PartTwo.xcodeproj/project.pbxproj @@ -7,6 +7,10 @@ objects = { /* Begin PBXBuildFile section */ + 840E44741BA9C4170000D69A /* SocialMediaView.m in Sources */ = {isa = PBXBuildFile; fileRef = 840E44731BA9C4170000D69A /* SocialMediaView.m */; settings = {ASSET_TAGS = (); }; }; + 845883C01BAD11930073CA5D /* xibSocialMediaView.xib in Resources */ = {isa = PBXBuildFile; fileRef = 845883BF1BAD11930073CA5D /* xibSocialMediaView.xib */; settings = {ASSET_TAGS = (); }; }; + 845883C31BAD11DC0073CA5D /* xibSocialMediaView.m in Sources */ = {isa = PBXBuildFile; fileRef = 845883C21BAD11DC0073CA5D /* xibSocialMediaView.m */; settings = {ASSET_TAGS = (); }; }; + 845883C61BAD12280073CA5D /* xibViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = 845883C51BAD12280073CA5D /* xibViewController.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 +39,14 @@ /* End PBXContainerItemProxy section */ /* Begin PBXFileReference section */ + 840E44721BA9C4170000D69A /* SocialMediaView.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SocialMediaView.h; sourceTree = ""; }; + 840E44731BA9C4170000D69A /* SocialMediaView.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = SocialMediaView.m; sourceTree = ""; }; + 844C76791BA9CAC300A9DBB7 /* SocialMediaViewProtocol.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SocialMediaViewProtocol.h; sourceTree = ""; }; + 845883BF1BAD11930073CA5D /* xibSocialMediaView.xib */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = file.xib; path = xibSocialMediaView.xib; sourceTree = ""; }; + 845883C11BAD11DC0073CA5D /* xibSocialMediaView.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = xibSocialMediaView.h; sourceTree = ""; }; + 845883C21BAD11DC0073CA5D /* xibSocialMediaView.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = xibSocialMediaView.m; sourceTree = ""; }; + 845883C41BAD12280073CA5D /* xibViewController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = xibViewController.h; sourceTree = ""; }; + 845883C51BAD12280073CA5D /* xibViewController.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = xibViewController.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,7 +117,15 @@ 8DD1034B1BA66E0900CE483B /* AppDelegate.m */, 8DD1034D1BA66E0900CE483B /* ViewController.h */, 8DD1034E1BA66E0900CE483B /* ViewController.m */, + 840E44721BA9C4170000D69A /* SocialMediaView.h */, + 840E44731BA9C4170000D69A /* SocialMediaView.m */, + 844C76791BA9CAC300A9DBB7 /* SocialMediaViewProtocol.h */, 8DD103501BA66E0900CE483B /* Main.storyboard */, + 845883BF1BAD11930073CA5D /* xibSocialMediaView.xib */, + 845883C41BAD12280073CA5D /* xibViewController.h */, + 845883C51BAD12280073CA5D /* xibViewController.m */, + 845883C11BAD11DC0073CA5D /* xibSocialMediaView.h */, + 845883C21BAD11DC0073CA5D /* xibSocialMediaView.m */, 8DD103531BA66E0900CE483B /* Assets.xcassets */, 8DD103551BA66E0900CE483B /* LaunchScreen.storyboard */, 8DD103581BA66E0900CE483B /* Info.plist */, @@ -243,6 +263,7 @@ isa = PBXResourcesBuildPhase; buildActionMask = 2147483647; files = ( + 845883C01BAD11930073CA5D /* xibSocialMediaView.xib in Resources */, 8DD103571BA66E0900CE483B /* LaunchScreen.storyboard in Resources */, 8DD103541BA66E0900CE483B /* Assets.xcassets in Resources */, 8DD103521BA66E0900CE483B /* Main.storyboard in Resources */, @@ -270,8 +291,11 @@ isa = PBXSourcesBuildPhase; buildActionMask = 2147483647; files = ( + 845883C61BAD12280073CA5D /* xibViewController.m in Sources */, 8DD1034F1BA66E0900CE483B /* ViewController.m in Sources */, 8DD1034C1BA66E0900CE483B /* AppDelegate.m in Sources */, + 845883C31BAD11DC0073CA5D /* xibSocialMediaView.m in Sources */, + 840E44741BA9C4170000D69A /* SocialMediaView.m in Sources */, 8DD103491BA66E0900CE483B /* main.m in Sources */, ); runOnlyForDeploymentPostprocessing = 0; @@ -498,6 +522,7 @@ 8DD103731BA66E0900CE483B /* Release */, ); defaultConfigurationIsVisible = 0; + defaultConfigurationName = Release; }; 8DD103741BA66E0900CE483B /* Build configuration list for PBXNativeTarget "PartTwoTests" */ = { isa = XCConfigurationList; @@ -506,6 +531,7 @@ 8DD103761BA66E0900CE483B /* Release */, ); defaultConfigurationIsVisible = 0; + defaultConfigurationName = Release; }; 8DD103771BA66E0900CE483B /* Build configuration list for PBXNativeTarget "PartTwoUITests" */ = { isa = XCConfigurationList; @@ -514,6 +540,7 @@ 8DD103791BA66E0900CE483B /* Release */, ); defaultConfigurationIsVisible = 0; + defaultConfigurationName = Release; }; /* End XCConfigurationList section */ }; diff --git a/PartTwo/PartTwo.xcodeproj/project.xcworkspace/xcuserdata/diana.xcuserdatad/UserInterfaceState.xcuserstate b/PartTwo/PartTwo.xcodeproj/project.xcworkspace/xcuserdata/diana.xcuserdatad/UserInterfaceState.xcuserstate new file mode 100644 index 0000000..d1b1d68 Binary files /dev/null and b/PartTwo/PartTwo.xcodeproj/project.xcworkspace/xcuserdata/diana.xcuserdatad/UserInterfaceState.xcuserstate differ diff --git a/PartTwo/PartTwo.xcodeproj/xcuserdata/diana.xcuserdatad/xcschemes/PartTwo.xcscheme b/PartTwo/PartTwo.xcodeproj/xcuserdata/diana.xcuserdatad/xcschemes/PartTwo.xcscheme new file mode 100644 index 0000000..7b83b68 --- /dev/null +++ b/PartTwo/PartTwo.xcodeproj/xcuserdata/diana.xcuserdatad/xcschemes/PartTwo.xcscheme @@ -0,0 +1,111 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/PartTwo/PartTwo.xcodeproj/xcuserdata/diana.xcuserdatad/xcschemes/xcschememanagement.plist b/PartTwo/PartTwo.xcodeproj/xcuserdata/diana.xcuserdatad/xcschemes/xcschememanagement.plist new file mode 100644 index 0000000..8d9c097 --- /dev/null +++ b/PartTwo/PartTwo.xcodeproj/xcuserdata/diana.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/Assets.xcassets/Contents.json b/PartTwo/PartTwo/Assets.xcassets/Contents.json new file mode 100644 index 0000000..da4a164 --- /dev/null +++ b/PartTwo/PartTwo/Assets.xcassets/Contents.json @@ -0,0 +1,6 @@ +{ + "info" : { + "version" : 1, + "author" : "xcode" + } +} \ No newline at end of file diff --git a/PartTwo/PartTwo/Assets.xcassets/UIView.imageset/Contents.json b/PartTwo/PartTwo/Assets.xcassets/UIView.imageset/Contents.json new file mode 100644 index 0000000..7eea07a --- /dev/null +++ b/PartTwo/PartTwo/Assets.xcassets/UIView.imageset/Contents.json @@ -0,0 +1,21 @@ +{ + "images" : [ + { + "idiom" : "universal", + "filename" : "UIView.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/PartTwo/PartTwo/Assets.xcassets/UIView.imageset/UIView.png b/PartTwo/PartTwo/Assets.xcassets/UIView.imageset/UIView.png new file mode 100644 index 0000000..d48027d Binary files /dev/null and b/PartTwo/PartTwo/Assets.xcassets/UIView.imageset/UIView.png differ diff --git a/PartTwo/PartTwo/Assets.xcassets/UIView2.imageset/Contents.json b/PartTwo/PartTwo/Assets.xcassets/UIView2.imageset/Contents.json new file mode 100644 index 0000000..7eea07a --- /dev/null +++ b/PartTwo/PartTwo/Assets.xcassets/UIView2.imageset/Contents.json @@ -0,0 +1,21 @@ +{ + "images" : [ + { + "idiom" : "universal", + "filename" : "UIView.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/PartTwo/PartTwo/Assets.xcassets/UIView2.imageset/UIView.png b/PartTwo/PartTwo/Assets.xcassets/UIView2.imageset/UIView.png new file mode 100644 index 0000000..1d6d96d Binary files /dev/null and b/PartTwo/PartTwo/Assets.xcassets/UIView2.imageset/UIView.png differ diff --git a/PartTwo/PartTwo/Assets.xcassets/UIView3.imageset/Contents.json b/PartTwo/PartTwo/Assets.xcassets/UIView3.imageset/Contents.json new file mode 100644 index 0000000..7eea07a --- /dev/null +++ b/PartTwo/PartTwo/Assets.xcassets/UIView3.imageset/Contents.json @@ -0,0 +1,21 @@ +{ + "images" : [ + { + "idiom" : "universal", + "filename" : "UIView.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/PartTwo/PartTwo/Assets.xcassets/UIView3.imageset/UIView.png b/PartTwo/PartTwo/Assets.xcassets/UIView3.imageset/UIView.png new file mode 100644 index 0000000..c6cfea6 Binary files /dev/null and b/PartTwo/PartTwo/Assets.xcassets/UIView3.imageset/UIView.png differ diff --git a/PartTwo/PartTwo/Assets.xcassets/blueCircle.imageset/Contents.json b/PartTwo/PartTwo/Assets.xcassets/blueCircle.imageset/Contents.json new file mode 100644 index 0000000..6c93616 --- /dev/null +++ b/PartTwo/PartTwo/Assets.xcassets/blueCircle.imageset/Contents.json @@ -0,0 +1,21 @@ +{ + "images" : [ + { + "idiom" : "universal", + "filename" : "blueCircle.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/PartTwo/PartTwo/Assets.xcassets/blueCircle.imageset/blueCircle.png b/PartTwo/PartTwo/Assets.xcassets/blueCircle.imageset/blueCircle.png new file mode 100644 index 0000000..424ff06 Binary files /dev/null and b/PartTwo/PartTwo/Assets.xcassets/blueCircle.imageset/blueCircle.png differ diff --git a/PartTwo/PartTwo/Assets.xcassets/comment.imageset/Contents.json b/PartTwo/PartTwo/Assets.xcassets/comment.imageset/Contents.json new file mode 100644 index 0000000..a95ef61 --- /dev/null +++ b/PartTwo/PartTwo/Assets.xcassets/comment.imageset/Contents.json @@ -0,0 +1,21 @@ +{ + "images" : [ + { + "idiom" : "universal", + "filename" : "comment.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/PartTwo/PartTwo/Assets.xcassets/comment.imageset/comment.png b/PartTwo/PartTwo/Assets.xcassets/comment.imageset/comment.png new file mode 100644 index 0000000..71a8d7d Binary files /dev/null and b/PartTwo/PartTwo/Assets.xcassets/comment.imageset/comment.png differ diff --git a/PartTwo/PartTwo/Assets.xcassets/greenCircle.imageset/Contents.json b/PartTwo/PartTwo/Assets.xcassets/greenCircle.imageset/Contents.json new file mode 100644 index 0000000..a4eb14b --- /dev/null +++ b/PartTwo/PartTwo/Assets.xcassets/greenCircle.imageset/Contents.json @@ -0,0 +1,21 @@ +{ + "images" : [ + { + "idiom" : "universal", + "filename" : "greenCircle.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/PartTwo/PartTwo/Assets.xcassets/greenCircle.imageset/greenCircle.png b/PartTwo/PartTwo/Assets.xcassets/greenCircle.imageset/greenCircle.png new file mode 100644 index 0000000..d8625f2 Binary files /dev/null and b/PartTwo/PartTwo/Assets.xcassets/greenCircle.imageset/greenCircle.png differ diff --git a/PartTwo/PartTwo/Assets.xcassets/like.imageset/Contents.json b/PartTwo/PartTwo/Assets.xcassets/like.imageset/Contents.json new file mode 100644 index 0000000..5126149 --- /dev/null +++ b/PartTwo/PartTwo/Assets.xcassets/like.imageset/Contents.json @@ -0,0 +1,21 @@ +{ + "images" : [ + { + "idiom" : "universal", + "filename" : "like.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/PartTwo/PartTwo/Assets.xcassets/like.imageset/like.png b/PartTwo/PartTwo/Assets.xcassets/like.imageset/like.png new file mode 100644 index 0000000..3ffc427 Binary files /dev/null and b/PartTwo/PartTwo/Assets.xcassets/like.imageset/like.png differ diff --git a/PartTwo/PartTwo/Assets.xcassets/redCircle.imageset/Contents.json b/PartTwo/PartTwo/Assets.xcassets/redCircle.imageset/Contents.json new file mode 100644 index 0000000..6e8566d --- /dev/null +++ b/PartTwo/PartTwo/Assets.xcassets/redCircle.imageset/Contents.json @@ -0,0 +1,21 @@ +{ + "images" : [ + { + "idiom" : "universal", + "filename" : "redCircle.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/PartTwo/PartTwo/Assets.xcassets/redCircle.imageset/redCircle.png b/PartTwo/PartTwo/Assets.xcassets/redCircle.imageset/redCircle.png new file mode 100644 index 0000000..35f7aa0 Binary files /dev/null and b/PartTwo/PartTwo/Assets.xcassets/redCircle.imageset/redCircle.png differ diff --git a/PartTwo/PartTwo/Assets.xcassets/share.imageset/Contents.json b/PartTwo/PartTwo/Assets.xcassets/share.imageset/Contents.json new file mode 100644 index 0000000..bfbe1c1 --- /dev/null +++ b/PartTwo/PartTwo/Assets.xcassets/share.imageset/Contents.json @@ -0,0 +1,21 @@ +{ + "images" : [ + { + "idiom" : "universal", + "filename" : "share.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/PartTwo/PartTwo/Assets.xcassets/share.imageset/share.png b/PartTwo/PartTwo/Assets.xcassets/share.imageset/share.png new file mode 100644 index 0000000..bb3c8eb Binary files /dev/null and b/PartTwo/PartTwo/Assets.xcassets/share.imageset/share.png differ diff --git a/PartTwo/PartTwo/Assets.xcassets/xib.imageset/Contents.json b/PartTwo/PartTwo/Assets.xcassets/xib.imageset/Contents.json new file mode 100644 index 0000000..dd3caf7 --- /dev/null +++ b/PartTwo/PartTwo/Assets.xcassets/xib.imageset/Contents.json @@ -0,0 +1,21 @@ +{ + "images" : [ + { + "idiom" : "universal", + "filename" : "xib.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/PartTwo/PartTwo/Assets.xcassets/xib.imageset/xib.png b/PartTwo/PartTwo/Assets.xcassets/xib.imageset/xib.png new file mode 100644 index 0000000..fa851cc Binary files /dev/null and b/PartTwo/PartTwo/Assets.xcassets/xib.imageset/xib.png differ diff --git a/PartTwo/PartTwo/Base.lproj/Main.storyboard b/PartTwo/PartTwo/Base.lproj/Main.storyboard index f56d2f3..d4ca175 100644 --- a/PartTwo/PartTwo/Base.lproj/Main.storyboard +++ b/PartTwo/PartTwo/Base.lproj/Main.storyboard @@ -1,13 +1,14 @@ - + - + + - + @@ -15,11 +16,131 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/PartTwo/PartTwo/SocialMediaView.h b/PartTwo/PartTwo/SocialMediaView.h new file mode 100644 index 0000000..d6cc33b --- /dev/null +++ b/PartTwo/PartTwo/SocialMediaView.h @@ -0,0 +1,17 @@ +// +// SocialMediaView.h +// PartTwo +// +// Created by Diana Elezaj on 9/16/15. +// Copyright © 2015 Mike Kavouras. All rights reserved. +// + +#import +#import "SocialMediaViewProtocol.h" + +@interface SocialMediaView : UIView + +//property of type id (any object) that conforms to the protocol called delegate +@property (nonatomic, weak) id delegate; + +@end diff --git a/PartTwo/PartTwo/SocialMediaView.m b/PartTwo/PartTwo/SocialMediaView.m new file mode 100644 index 0000000..013b52f --- /dev/null +++ b/PartTwo/PartTwo/SocialMediaView.m @@ -0,0 +1,37 @@ +// +// SocialMediaView.m +// PartTwo +// +// Created by Diana Elezaj on 9/16/15. +// Copyright © 2015 Mike Kavouras. All rights reserved. +// + +#import "SocialMediaView.h" +#import "ViewController.h" +#import "SocialMediaViewProtocol.h" + +@interface SocialMediaView () + + +@end + +@implementation SocialMediaView + +-(IBAction)commentTapped:(UIButton*)sender { + //self is SocialMediaView + //delegate is ViewController + + [self.delegate commentButtonTapped:self]; + NSLog(@"UIView Comment tapped"); +} + +-(IBAction)likeTapped:(UIButton*)sender { + [self.delegate likeButtonTapped:self]; + NSLog(@"UIView like tapped"); + +} +-(IBAction)shareTapped:(UIButton*)sender { + [self.delegate shareButtonTapped:self]; + NSLog(@"UIView share tapped"); +} +@end diff --git a/PartTwo/PartTwo/SocialMediaViewProtocol.h b/PartTwo/PartTwo/SocialMediaViewProtocol.h new file mode 100644 index 0000000..3466ea3 --- /dev/null +++ b/PartTwo/PartTwo/SocialMediaViewProtocol.h @@ -0,0 +1,22 @@ +// +// SocialMediaViewProtocol.h +// PartTwo +// +// Created by Diana Elezaj on 9/16/15. +// Copyright © 2015 Mike Kavouras. All rights reserved. +// + +#import + +@class SocialMediaView; + +@protocol SocialMediaViewProtocol + +@required + +//create methods in our protocol that will not return anything +- (void)commentButtonTapped:(SocialMediaView *)view; +- (void)likeButtonTapped:(SocialMediaView *)view; +- (void)shareButtonTapped:(SocialMediaView *)view; + +@end diff --git a/PartTwo/PartTwo/ViewController.m b/PartTwo/PartTwo/ViewController.m index adca251..6920785 100644 --- a/PartTwo/PartTwo/ViewController.m +++ b/PartTwo/PartTwo/ViewController.m @@ -7,8 +7,15 @@ // #import "ViewController.h" +#import "SocialMediaView.h" +#import "SocialMediaViewProtocol.h" +#import -@interface ViewController () +@interface ViewController () +@property (weak, nonatomic) IBOutlet SocialMediaView *socialMediaView; +@property (weak, nonatomic) IBOutlet UIButton *commentButtonProperty; +@property (weak, nonatomic) IBOutlet UIButton *likeButtonProperty; +@property (weak, nonatomic) IBOutlet UIButton *shareButtonProperty; @end @@ -16,12 +23,35 @@ @implementation ViewController - (void)viewDidLoad { [super viewDidLoad]; - // Do any additional setup after loading the view, typically from a nib. + + //customize view borders + self.socialMediaView.layer.borderColor = [UIColor whiteColor].CGColor; + self.socialMediaView.layer.borderWidth = 3.0f; + + //buttons colors + self.commentButtonProperty.backgroundColor = [UIColor colorWithRed:0.36 green:0.64 blue:0.24 alpha:1.0]; + self.likeButtonProperty.backgroundColor = [UIColor colorWithRed:0.23 green:0.42 blue:0.71 alpha:1.0]; + self.shareButtonProperty.backgroundColor = [UIColor colorWithRed:0.87 green:0.20 blue:0.20 alpha:1.0]; + + //set view color green, by default + self.view.backgroundColor = [UIColor colorWithRed:0.36 green:0.64 blue:0.24 alpha:1.0]; + + //assign the delegate + self.socialMediaView.delegate = self; + } + +- (void)commentButtonTapped:(SocialMediaView *)view{ + self.view.backgroundColor = [UIColor colorWithRed:0.36 green:0.64 blue:0.24 alpha:1.0]; +} +- (void)likeButtonTapped:(SocialMediaView *)view{ + self.view.backgroundColor = [UIColor colorWithRed:0.23 green:0.42 blue:0.71 alpha:1.0]; +} +- (void)shareButtonTapped:(SocialMediaView *)view{ + self.view.backgroundColor = [UIColor colorWithRed:0.87 green:0.20 blue:0.20 alpha:1.0]; } - (void)didReceiveMemoryWarning { [super didReceiveMemoryWarning]; - // Dispose of any resources that can be recreated. } @end diff --git a/PartTwo/PartTwo/xibSocialMediaView.h b/PartTwo/PartTwo/xibSocialMediaView.h new file mode 100644 index 0000000..6597eb9 --- /dev/null +++ b/PartTwo/PartTwo/xibSocialMediaView.h @@ -0,0 +1,16 @@ +// +// xibSocialMediaView.h +// PartTwo +// +// Created by Diana Elezaj on 9/18/15. +// Copyright © 2015 Mike Kavouras. All rights reserved. +// + +#import +#import "SocialMediaViewProtocol.h" + +@interface xibSocialMediaView : UIView + +@property (nonatomic, weak) id delegate; + +@end diff --git a/PartTwo/PartTwo/xibSocialMediaView.m b/PartTwo/PartTwo/xibSocialMediaView.m new file mode 100644 index 0000000..32c2d54 --- /dev/null +++ b/PartTwo/PartTwo/xibSocialMediaView.m @@ -0,0 +1,30 @@ +// +// xibSocialMediaView.m +// PartTwo +// +// Created by Diana Elezaj on 9/18/15. +// Copyright © 2015 Mike Kavouras. All rights reserved. +// + +#import "xibSocialMediaView.h" +#import "xibViewController.h" +#import "SocialMediaViewProtocol.h" + + +@implementation xibSocialMediaView + +-(IBAction)commentTapped:(UIButton*)sender { + [self.delegate commentButtonTapped:self]; + NSLog(@"XIB Comment tapped"); +} +- (IBAction)likeTapped:(UIButton *)sender { + [self.delegate likeButtonTapped:self]; + NSLog(@"XIB like tapped"); +} +- (IBAction)shareTapped:(UIButton *)sender { + [self.delegate shareButtonTapped:self]; + NSLog(@"XIB share tapped"); +} + + +@end diff --git a/PartTwo/PartTwo/xibSocialMediaView.xib b/PartTwo/PartTwo/xibSocialMediaView.xib new file mode 100644 index 0000000..04b7f79 --- /dev/null +++ b/PartTwo/PartTwo/xibSocialMediaView.xib @@ -0,0 +1,110 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/PartTwo/PartTwo/xibViewController.h b/PartTwo/PartTwo/xibViewController.h new file mode 100644 index 0000000..35b08d3 --- /dev/null +++ b/PartTwo/PartTwo/xibViewController.h @@ -0,0 +1,14 @@ +// +// xibViewController.h +// PartTwo +// +// Created by Diana Elezaj on 9/18/15. +// Copyright © 2015 Mike Kavouras. All rights reserved. +// + +#import +#import "SocialMediaViewProtocol.h" + +@interface xibViewController : UIViewController + +@end diff --git a/PartTwo/PartTwo/xibViewController.m b/PartTwo/PartTwo/xibViewController.m new file mode 100644 index 0000000..623b528 --- /dev/null +++ b/PartTwo/PartTwo/xibViewController.m @@ -0,0 +1,48 @@ +// +// xibViewController.m +// PartTwo +// +// Created by Diana Elezaj on 9/18/15. +// Copyright © 2015 Mike Kavouras. All rights reserved. +// + +#import "xibViewController.h" +#import "xibSocialMediaView.h" +#import "SocialMediaViewProtocol.h" + + +@interface xibViewController () +@property (weak, nonatomic) IBOutlet UIView *customView; + +@end + +@implementation xibViewController + +- (void)viewDidLoad { + [super viewDidLoad]; + + NSArray *views = [[NSBundle mainBundle] loadNibNamed:@"xibSocialMediaView" owner:self options:nil]; + xibSocialMediaView *SMVContainer = [views firstObject]; + + [self.customView addSubview:SMVContainer]; + SMVContainer.frame = self.customView.bounds; + + SMVContainer.delegate = self; + self.view.backgroundColor = [UIColor colorWithRed:0.36 green:0.64 blue:0.24 alpha:1.0]; +} + +- (void)commentButtonTapped:(SocialMediaView *)view{ + self.view.backgroundColor = [UIColor colorWithRed:0.36 green:0.64 blue:0.24 alpha:1.0]; +} +- (void)likeButtonTapped:(SocialMediaView *)view{ + self.view.backgroundColor = [UIColor colorWithRed:0.23 green:0.42 blue:0.71 alpha:1.0]; +} +- (void)shareButtonTapped:(SocialMediaView *)view{ + self.view.backgroundColor = [UIColor colorWithRed:0.87 green:0.20 blue:0.20 alpha:1.0]; +} + +- (void)didReceiveMemoryWarning { + [super didReceiveMemoryWarning]; +} + +@end diff --git a/PickAPic/.DS_Store b/PickAPic/.DS_Store new file mode 100644 index 0000000..87e72dc Binary files /dev/null and b/PickAPic/.DS_Store differ diff --git a/PickAPic/PickAPic.xcodeproj/project.xcworkspace/xcuserdata/diana.xcuserdatad/UserInterfaceState.xcuserstate b/PickAPic/PickAPic.xcodeproj/project.xcworkspace/xcuserdata/diana.xcuserdatad/UserInterfaceState.xcuserstate new file mode 100644 index 0000000..3f3b3e4 Binary files /dev/null and b/PickAPic/PickAPic.xcodeproj/project.xcworkspace/xcuserdata/diana.xcuserdatad/UserInterfaceState.xcuserstate differ diff --git a/PickAPic/PickAPic.xcodeproj/xcuserdata/diana.xcuserdatad/xcschemes/PickAPic.xcscheme b/PickAPic/PickAPic.xcodeproj/xcuserdata/diana.xcuserdatad/xcschemes/PickAPic.xcscheme new file mode 100644 index 0000000..72d7729 --- /dev/null +++ b/PickAPic/PickAPic.xcodeproj/xcuserdata/diana.xcuserdatad/xcschemes/PickAPic.xcscheme @@ -0,0 +1,111 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/PickAPic/PickAPic.xcodeproj/xcuserdata/diana.xcuserdatad/xcschemes/xcschememanagement.plist b/PickAPic/PickAPic.xcodeproj/xcuserdata/diana.xcuserdatad/xcschemes/xcschememanagement.plist new file mode 100644 index 0000000..bb91a10 --- /dev/null +++ b/PickAPic/PickAPic.xcodeproj/xcuserdata/diana.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/Assets.xcassets/Contents.json b/PickAPic/PickAPic/Assets.xcassets/Contents.json new file mode 100644 index 0000000..da4a164 --- /dev/null +++ b/PickAPic/PickAPic/Assets.xcassets/Contents.json @@ -0,0 +1,6 @@ +{ + "info" : { + "version" : 1, + "author" : "xcode" + } +} \ No newline at end of file diff --git a/PickAPic/PickAPic/Base.lproj/Main.storyboard b/PickAPic/PickAPic/Base.lproj/Main.storyboard index f055f71..53d28ad 100644 --- a/PickAPic/PickAPic/Base.lproj/Main.storyboard +++ b/PickAPic/PickAPic/Base.lproj/Main.storyboard @@ -1,5 +1,5 @@ - + @@ -16,12 +16,55 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/PickAPic/PickAPic/ViewController.m b/PickAPic/PickAPic/ViewController.m index acd6613..fe2c741 100644 --- a/PickAPic/PickAPic/ViewController.m +++ b/PickAPic/PickAPic/ViewController.m @@ -8,11 +8,57 @@ #import "ViewController.h" -@interface ViewController () +@interface ViewController () + +@property (weak, nonatomic) IBOutlet UIImageView *imageView; +@property (weak, nonatomic) IBOutlet UIButton *cameraRoll; +@property (nonatomic) UIImagePickerController *imagePickerController; @end @implementation ViewController +- (void)viewDidLoad{ + [super viewDidLoad]; + self.cameraRoll.hidden = YES; + self.imagePickerController = [[UIImagePickerController alloc] init]; + [self goUIImagePickerController]; +} + +- (void)goUIImagePickerController{ + + self.imagePickerController.delegate = self; + + self.imagePickerController.sourceType = UIImagePickerControllerSourceTypePhotoLibrary; + NSLog (@"first "); + + self.imagePickerController.mediaTypes = [UIImagePickerController availableMediaTypesForSourceType:UIImagePickerControllerSourceTypePhotoLibrary]; + NSLog (@"sec "); + + [self.navigationController presentViewController:self.imagePickerController animated:YES completion:nil]; + NSLog (@"third "); +} + +#pragma mark - UIImagePickerControllerDelegate + +- (void)imagePickerController:(UIImagePickerController *)picker didFinishPickingMediaWithInfo:(NSDictionary *)info +{ + + self.cameraRoll.hidden = NO; + self.imageView.image = (UIImage *)[info objectForKey:UIImagePickerControllerOriginalImage]; + + [self.navigationController dismissViewControllerAnimated:picker completion:nil]; + +} + +- (void)imagePickerControllerDidCancel:(UIImagePickerController *)picker { [self.navigationController dismissViewControllerAnimated:YES completion:nil]; +} + +#pragma mark - Camera Roll Button Tapped + +- (IBAction)cameraRollButtonTapped:(UIButton *)sender { + [self goUIImagePickerController]; + +} @end