Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
80 changes: 80 additions & 0 deletions PartTwo/CustomView.xib
Original file line number Diff line number Diff line change
@@ -0,0 +1,80 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<document type="com.apple.InterfaceBuilder3.CocoaTouch.XIB" version="3.0" toolsVersion="8191" systemVersion="14F27" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" useTraitCollections="YES">
<dependencies>
<deployment identifier="iOS"/>
<plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="8154"/>
</dependencies>
<objects>
<placeholder placeholderIdentifier="IBFilesOwner" id="-1" userLabel="File's Owner"/>
<placeholder placeholderIdentifier="IBFirstResponder" id="-2" customClass="UIResponder"/>
<view contentMode="scaleToFill" id="iN0-l3-epB" customClass="SocialMediaView">
<rect key="frame" x="0.0" y="0.0" width="600" height="600"/>
<autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
<subviews>
<button opaque="NO" contentMode="scaleToFill" contentHorizontalAlignment="center" contentVerticalAlignment="center" buttonType="roundedRect" lineBreakMode="middleTruncation" translatesAutoresizingMaskIntoConstraints="NO" id="Vx1-eQ-vFZ">
<rect key="frame" x="0.0" y="150" width="600" height="100"/>
<constraints>
<constraint firstAttribute="height" constant="100" id="Kpi-jk-V0W"/>
<constraint firstAttribute="width" constant="100" id="huc-Ty-Nki"/>
</constraints>
<state key="normal" title="Like"/>
<variation key="default">
<mask key="constraints">
<exclude reference="huc-Ty-Nki"/>
</mask>
</variation>
<connections>
<action selector="likeButtonTapped:" destination="iN0-l3-epB" eventType="touchUpInside" id="mNR-r3-wlx"/>
</connections>
</button>
<button opaque="NO" contentMode="scaleToFill" contentHorizontalAlignment="center" contentVerticalAlignment="center" buttonType="roundedRect" lineBreakMode="middleTruncation" translatesAutoresizingMaskIntoConstraints="NO" id="wqO-iA-7x3">
<rect key="frame" x="0.0" y="350" width="600" height="100"/>
<constraints>
<constraint firstAttribute="width" constant="100" id="PML-Ch-UDP"/>
<constraint firstAttribute="height" constant="100" id="fJh-i6-ls6"/>
</constraints>
<state key="normal" title="Share"/>
<variation key="default">
<mask key="constraints">
<exclude reference="PML-Ch-UDP"/>
</mask>
</variation>
<connections>
<action selector="shareButtonTapped:" destination="iN0-l3-epB" eventType="touchUpInside" id="YVQ-Da-6XL"/>
</connections>
</button>
<button opaque="NO" contentMode="scaleToFill" contentHorizontalAlignment="center" contentVerticalAlignment="center" buttonType="roundedRect" lineBreakMode="middleTruncation" translatesAutoresizingMaskIntoConstraints="NO" id="1Ud-r2-HAG">
<rect key="frame" x="0.0" y="250" width="600" height="100"/>
<constraints>
<constraint firstAttribute="height" constant="100" id="JY2-HW-ATi"/>
<constraint firstAttribute="width" constant="100" id="Xb4-z5-WiN"/>
</constraints>
<state key="normal" title="Comment"/>
<variation key="default">
<mask key="constraints">
<exclude reference="Xb4-z5-WiN"/>
</mask>
</variation>
<connections>
<action selector="commentButtonTapped:" destination="iN0-l3-epB" eventType="touchUpInside" id="I8Y-n7-hY6"/>
</connections>
</button>
</subviews>
<color key="backgroundColor" white="1" alpha="1" colorSpace="custom" customColorSpace="calibratedWhite"/>
<constraints>
<constraint firstItem="1Ud-r2-HAG" firstAttribute="centerY" secondItem="iN0-l3-epB" secondAttribute="centerY" id="0X8-2u-Rxg"/>
<constraint firstAttribute="trailing" secondItem="wqO-iA-7x3" secondAttribute="trailing" id="4We-ip-YH2"/>
<constraint firstItem="wqO-iA-7x3" firstAttribute="top" secondItem="1Ud-r2-HAG" secondAttribute="bottom" id="6Ex-KD-za8"/>
<constraint firstItem="1Ud-r2-HAG" firstAttribute="centerX" secondItem="wqO-iA-7x3" secondAttribute="centerX" id="HPR-hU-bnz"/>
<constraint firstItem="1Ud-r2-HAG" firstAttribute="centerX" secondItem="iN0-l3-epB" secondAttribute="centerX" id="LkI-AX-lEt"/>
<constraint firstAttribute="trailing" secondItem="Vx1-eQ-vFZ" secondAttribute="trailing" id="NZW-px-BxL"/>
<constraint firstItem="Vx1-eQ-vFZ" firstAttribute="leading" secondItem="iN0-l3-epB" secondAttribute="leading" id="PtJ-CE-97P"/>
<constraint firstItem="1Ud-r2-HAG" firstAttribute="top" secondItem="Vx1-eQ-vFZ" secondAttribute="bottom" id="Six-zY-FoF"/>
<constraint firstAttribute="trailing" secondItem="1Ud-r2-HAG" secondAttribute="trailing" id="Yym-0C-dRo"/>
<constraint firstItem="wqO-iA-7x3" firstAttribute="leading" secondItem="iN0-l3-epB" secondAttribute="leading" id="eld-lm-XxH"/>
<constraint firstItem="1Ud-r2-HAG" firstAttribute="leading" secondItem="iN0-l3-epB" secondAttribute="leading" id="hrS-Ma-tgi"/>
<constraint firstItem="1Ud-r2-HAG" firstAttribute="centerX" secondItem="Vx1-eQ-vFZ" secondAttribute="centerX" id="qK7-OE-wgE"/>
</constraints>
</view>
</objects>
</document>
15 changes: 15 additions & 0 deletions PartTwo/PartTwo.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,8 @@
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 */; };
9AD49E371BA90F4800426529 /* CustomView.xib in Resources */ = {isa = PBXBuildFile; fileRef = 9AD49E361BA90F4800426529 /* CustomView.xib */; settings = {ASSET_TAGS = (); }; };
9AD49E451BA91C9400426529 /* SocialMediaView.m in Sources */ = {isa = PBXBuildFile; fileRef = 9AD49E441BA91C9400426529 /* SocialMediaView.m */; settings = {ASSET_TAGS = (); }; };
/* End PBXBuildFile section */

/* Begin PBXContainerItemProxy section */
Expand Down Expand Up @@ -51,6 +53,10 @@
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 = "<group>"; };
8DD1036E1BA66E0900CE483B /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = "<group>"; };
9AD49E361BA90F4800426529 /* CustomView.xib */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = file.xib; name = CustomView.xib; path = ../CustomView.xib; sourceTree = "<group>"; };
9AD49E431BA91C9400426529 /* SocialMediaView.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = SocialMediaView.h; path = ../SocialMediaView.h; sourceTree = "<group>"; };
9AD49E441BA91C9400426529 /* SocialMediaView.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = SocialMediaView.m; path = ../SocialMediaView.m; sourceTree = "<group>"; };
9AEED1271BA9F797006638A4 /* SocialMediaDelegate.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SocialMediaDelegate.h; sourceTree = "<group>"; };
/* End PBXFileReference section */

/* Begin PBXFrameworksBuildPhase section */
Expand Down Expand Up @@ -103,8 +109,12 @@
children = (
8DD1034A1BA66E0900CE483B /* AppDelegate.h */,
8DD1034B1BA66E0900CE483B /* AppDelegate.m */,
9AEED1271BA9F797006638A4 /* SocialMediaDelegate.h */,
8DD1034D1BA66E0900CE483B /* ViewController.h */,
8DD1034E1BA66E0900CE483B /* ViewController.m */,
9AD49E431BA91C9400426529 /* SocialMediaView.h */,
9AD49E441BA91C9400426529 /* SocialMediaView.m */,
9AD49E361BA90F4800426529 /* CustomView.xib */,
8DD103501BA66E0900CE483B /* Main.storyboard */,
8DD103531BA66E0900CE483B /* Assets.xcassets */,
8DD103551BA66E0900CE483B /* LaunchScreen.storyboard */,
Expand Down Expand Up @@ -244,6 +254,7 @@
buildActionMask = 2147483647;
files = (
8DD103571BA66E0900CE483B /* LaunchScreen.storyboard in Resources */,
9AD49E371BA90F4800426529 /* CustomView.xib in Resources */,
8DD103541BA66E0900CE483B /* Assets.xcassets in Resources */,
8DD103521BA66E0900CE483B /* Main.storyboard in Resources */,
);
Expand Down Expand Up @@ -272,6 +283,7 @@
files = (
8DD1034F1BA66E0900CE483B /* ViewController.m in Sources */,
8DD1034C1BA66E0900CE483B /* AppDelegate.m in Sources */,
9AD49E451BA91C9400426529 /* SocialMediaView.m in Sources */,
8DD103491BA66E0900CE483B /* main.m in Sources */,
);
runOnlyForDeploymentPostprocessing = 0;
Expand Down Expand Up @@ -498,6 +510,7 @@
8DD103731BA66E0900CE483B /* Release */,
);
defaultConfigurationIsVisible = 0;
defaultConfigurationName = Release;
};
8DD103741BA66E0900CE483B /* Build configuration list for PBXNativeTarget "PartTwoTests" */ = {
isa = XCConfigurationList;
Expand All @@ -506,6 +519,7 @@
8DD103761BA66E0900CE483B /* Release */,
);
defaultConfigurationIsVisible = 0;
defaultConfigurationName = Release;
};
8DD103771BA66E0900CE483B /* Build configuration list for PBXNativeTarget "PartTwoUITests" */ = {
isa = XCConfigurationList;
Expand All @@ -514,6 +528,7 @@
8DD103791BA66E0900CE483B /* Release */,
);
defaultConfigurationIsVisible = 0;
defaultConfigurationName = Release;
};
/* End XCConfigurationList section */
};
Expand Down
25 changes: 22 additions & 3 deletions PartTwo/PartTwo/Base.lproj/Main.storyboard
Original file line number Diff line number Diff line change
@@ -1,25 +1,44 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<document type="com.apple.InterfaceBuilder3.CocoaTouch.Storyboard.XIB" version="3.0" toolsVersion="6211" systemVersion="14A298i" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" useTraitCollections="YES" initialViewController="BYZ-38-t0r">
<document type="com.apple.InterfaceBuilder3.CocoaTouch.Storyboard.XIB" version="3.0" toolsVersion="8191" systemVersion="14F27" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" useTraitCollections="YES" initialViewController="BYZ-38-t0r">
<dependencies>
<plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="6204"/>
<deployment identifier="iOS"/>
<plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="8154"/>
</dependencies>
<scenes>
<!--View Controller-->
<scene sceneID="tne-QT-ifu">
<objects>
<viewController id="BYZ-38-t0r" customClass="ViewController" customModuleProvider="" sceneMemberID="viewController">
<viewController id="BYZ-38-t0r" customClass="ViewController" sceneMemberID="viewController">
<layoutGuides>
<viewControllerLayoutGuide type="top" id="y3c-jy-aDJ"/>
<viewControllerLayoutGuide type="bottom" id="wfy-db-euE"/>
</layoutGuides>
<view key="view" contentMode="scaleToFill" id="8bC-Xf-vdC">
<rect key="frame" x="0.0" y="0.0" width="600" height="600"/>
<autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
<subviews>
<view contentMode="scaleToFill" translatesAutoresizingMaskIntoConstraints="NO" id="wql-Ru-H4o" customClass="SocialMediaView">
<rect key="frame" x="150" y="150" width="300" height="300"/>
<color key="backgroundColor" white="1" alpha="1" colorSpace="calibratedWhite"/>
<constraints>
<constraint firstAttribute="width" constant="300" id="hhd-gk-Boq"/>
<constraint firstAttribute="height" constant="300" id="ous-Ro-YTm"/>
</constraints>
</view>
</subviews>
<color key="backgroundColor" white="1" alpha="1" colorSpace="custom" customColorSpace="calibratedWhite"/>
<constraints>
<constraint firstItem="wql-Ru-H4o" firstAttribute="centerX" secondItem="8bC-Xf-vdC" secondAttribute="centerX" id="A7f-KN-ADL"/>
<constraint firstItem="wql-Ru-H4o" firstAttribute="centerY" secondItem="8bC-Xf-vdC" secondAttribute="centerY" id="d7D-l5-GjA"/>
</constraints>
</view>
<connections>
<outlet property="customViewController" destination="wql-Ru-H4o" id="elb-rU-gbm"/>
</connections>
</viewController>
<placeholder placeholderIdentifier="IBFirstResponder" id="dkx-z0-nzr" sceneMemberID="firstResponder"/>
</objects>
<point key="canvasLocation" x="333" y="343"/>
</scene>
</scenes>
</document>
20 changes: 20 additions & 0 deletions PartTwo/PartTwo/SocialMediaDelegate.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
//
// SocialMediaDelegate.h
// PartTwo
//
// Created by Jamaal Sedayao on 9/16/15.
// Copyright © 2015 Mike Kavouras. All rights reserved.
//


#import <Foundation/Foundation.h>

@class SocialMediaView;

@protocol SocialMediaDelegate <NSObject>

- (void) socialMediaViewDidTapLikeButton:(SocialMediaView*)view;
- (void)socialMediaViewDidTapCommentButton:(SocialMediaView*)view;
- (void)socialMediaViewDidTapShareButton:(SocialMediaView*)view;

@end
2 changes: 2 additions & 0 deletions PartTwo/PartTwo/ViewController.h
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,10 @@

#import <UIKit/UIKit.h>


@interface ViewController : UIViewController



@end

39 changes: 33 additions & 6 deletions PartTwo/PartTwo/ViewController.m
Original file line number Diff line number Diff line change
Expand Up @@ -7,21 +7,48 @@
//

#import "ViewController.h"
#import "SocialMediaView.h"
#import "SocialMediaDelegate.h"

@interface ViewController () <SocialMediaDelegate>

@property (weak, nonatomic) IBOutlet UIView *customViewController;
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

you shouldnt call this viewController because its a view.


@interface ViewController ()

@end

@implementation ViewController

- (void)viewDidLoad {
[super viewDidLoad];
// Do any additional setup after loading the view, typically from a nib.
}


- (void)didReceiveMemoryWarning {
[super didReceiveMemoryWarning];
// Dispose of any resources that can be recreated.
NSArray *views = [[NSBundle mainBundle]loadNibNamed:@"CustomView" owner:self options:nil];

SocialMediaView *customView = [views firstObject];

[self.customViewController addSubview:customView];

customView.frame = self.customViewController.bounds;

customView.delegate = self;

}
- (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
17 changes: 17 additions & 0 deletions PartTwo/SocialMediaView.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
//
// SocialMediaView.h
// PartTwo
//
// Created by Jamaal Sedayao on 9/15/15.
// Copyright © 2015 Mike Kavouras. All rights reserved.
//

#import <UIKit/UIKit.h>
#import "SocialMediaDelegate.h"


@interface SocialMediaView : UIView

@property (nonatomic,weak) id <SocialMediaDelegate> delegate;

@end
27 changes: 27 additions & 0 deletions PartTwo/SocialMediaView.m
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
//
// SocialMediaView.m
// PartTwo
//
// Created by Jamaal Sedayao on 9/15/15.
// Copyright © 2015 Mike Kavouras. All rights reserved.
//

#import "SocialMediaView.h"

@implementation SocialMediaView


- (IBAction)likeButtonTapped:(id)sender {
[self.delegate socialMediaViewDidTapLikeButton:self];
}

- (IBAction)commentButtonTapped:(id)sender{
[self.delegate socialMediaViewDidTapCommentButton:self];
}

- (IBAction)shareButtonTapped:(id)sender {
[self.delegate socialMediaViewDidTapShareButton:self];
}


@end
Loading