Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

finished hw #26

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
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
Binary file added .DS_Store
Binary file not shown.
Binary file added PartTwo/.DS_Store
Binary file not shown.
15 changes: 15 additions & 0 deletions PartTwo/PartTwo.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,8 @@
objects = {

/* Begin PBXBuildFile section */
22DE3D441BACBDB200153600 /* CustomView.m in Sources */ = {isa = PBXBuildFile; fileRef = 22DE3D431BACBDB200153600 /* CustomView.m */; settings = {ASSET_TAGS = (); }; };
22DE3D461BACBDD600153600 /* CustomView.xib in Resources */ = {isa = PBXBuildFile; fileRef = 22DE3D451BACBDD600153600 /* CustomView.xib */; 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 */; };
Expand Down Expand Up @@ -35,6 +37,10 @@
/* End PBXContainerItemProxy section */

/* Begin PBXFileReference section */
22DE3D411BACBAEA00153600 /* CustomViewDelegate.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = CustomViewDelegate.h; sourceTree = "<group>"; };
22DE3D421BACBDB200153600 /* CustomView.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = CustomView.h; sourceTree = "<group>"; };
22DE3D431BACBDB200153600 /* CustomView.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = CustomView.m; sourceTree = "<group>"; };
22DE3D451BACBDD600153600 /* CustomView.xib */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = file.xib; path = CustomView.xib; sourceTree = "<group>"; };
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 = "<group>"; };
8DD1034A1BA66E0900CE483B /* AppDelegate.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = AppDelegate.h; sourceTree = "<group>"; };
Expand Down Expand Up @@ -105,6 +111,10 @@
8DD1034B1BA66E0900CE483B /* AppDelegate.m */,
8DD1034D1BA66E0900CE483B /* ViewController.h */,
8DD1034E1BA66E0900CE483B /* ViewController.m */,
22DE3D411BACBAEA00153600 /* CustomViewDelegate.h */,
22DE3D421BACBDB200153600 /* CustomView.h */,
22DE3D431BACBDB200153600 /* CustomView.m */,
22DE3D451BACBDD600153600 /* 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 */,
22DE3D461BACBDD600153600 /* CustomView.xib in Resources */,
8DD103541BA66E0900CE483B /* Assets.xcassets in Resources */,
8DD103521BA66E0900CE483B /* Main.storyboard in Resources */,
);
Expand Down Expand Up @@ -271,6 +282,7 @@
buildActionMask = 2147483647;
files = (
8DD1034F1BA66E0900CE483B /* ViewController.m in Sources */,
22DE3D441BACBDB200153600 /* CustomView.m in Sources */,
8DD1034C1BA66E0900CE483B /* AppDelegate.m in Sources */,
8DD103491BA66E0900CE483B /* main.m in Sources */,
);
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
Binary file not shown.
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
<?xml version="1.0" encoding="UTF-8"?>
<Bucket
type = "1"
version = "2.0">
</Bucket>
Original file line number Diff line number Diff line change
@@ -0,0 +1,111 @@
<?xml version="1.0" encoding="UTF-8"?>
<Scheme
LastUpgradeVersion = "0700"
version = "1.3">
<BuildAction
parallelizeBuildables = "YES"
buildImplicitDependencies = "YES">
<BuildActionEntries>
<BuildActionEntry
buildForTesting = "YES"
buildForRunning = "YES"
buildForProfiling = "YES"
buildForArchiving = "YES"
buildForAnalyzing = "YES">
<BuildableReference
BuildableIdentifier = "primary"
BlueprintIdentifier = "8DD103431BA66E0900CE483B"
BuildableName = "PartTwo.app"
BlueprintName = "PartTwo"
ReferencedContainer = "container:PartTwo.xcodeproj">
</BuildableReference>
</BuildActionEntry>
</BuildActionEntries>
</BuildAction>
<TestAction
buildConfiguration = "Debug"
selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB"
selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
shouldUseLaunchSchemeArgsEnv = "YES">
<Testables>
<TestableReference
skipped = "NO">
<BuildableReference
BuildableIdentifier = "primary"
BlueprintIdentifier = "8DD1035C1BA66E0900CE483B"
BuildableName = "PartTwoTests.xctest"
BlueprintName = "PartTwoTests"
ReferencedContainer = "container:PartTwo.xcodeproj">
</BuildableReference>
</TestableReference>
<TestableReference
skipped = "NO">
<BuildableReference
BuildableIdentifier = "primary"
BlueprintIdentifier = "8DD103671BA66E0900CE483B"
BuildableName = "PartTwoUITests.xctest"
BlueprintName = "PartTwoUITests"
ReferencedContainer = "container:PartTwo.xcodeproj">
</BuildableReference>
</TestableReference>
</Testables>
<MacroExpansion>
<BuildableReference
BuildableIdentifier = "primary"
BlueprintIdentifier = "8DD103431BA66E0900CE483B"
BuildableName = "PartTwo.app"
BlueprintName = "PartTwo"
ReferencedContainer = "container:PartTwo.xcodeproj">
</BuildableReference>
</MacroExpansion>
<AdditionalOptions>
</AdditionalOptions>
</TestAction>
<LaunchAction
buildConfiguration = "Debug"
selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB"
selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
launchStyle = "0"
useCustomWorkingDirectory = "NO"
ignoresPersistentStateOnLaunch = "NO"
debugDocumentVersioning = "YES"
debugServiceExtension = "internal"
allowLocationSimulation = "YES">
<BuildableProductRunnable
runnableDebuggingMode = "0">
<BuildableReference
BuildableIdentifier = "primary"
BlueprintIdentifier = "8DD103431BA66E0900CE483B"
BuildableName = "PartTwo.app"
BlueprintName = "PartTwo"
ReferencedContainer = "container:PartTwo.xcodeproj">
</BuildableReference>
</BuildableProductRunnable>
<AdditionalOptions>
</AdditionalOptions>
</LaunchAction>
<ProfileAction
buildConfiguration = "Release"
shouldUseLaunchSchemeArgsEnv = "YES"
savedToolIdentifier = ""
useCustomWorkingDirectory = "NO"
debugDocumentVersioning = "YES">
<BuildableProductRunnable
runnableDebuggingMode = "0">
<BuildableReference
BuildableIdentifier = "primary"
BlueprintIdentifier = "8DD103431BA66E0900CE483B"
BuildableName = "PartTwo.app"
BlueprintName = "PartTwo"
ReferencedContainer = "container:PartTwo.xcodeproj">
</BuildableReference>
</BuildableProductRunnable>
</ProfileAction>
<AnalyzeAction
buildConfiguration = "Debug">
</AnalyzeAction>
<ArchiveAction
buildConfiguration = "Release"
revealArchiveInOrganizer = "YES">
</ArchiveAction>
</Scheme>
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>SchemeUserState</key>
<dict>
<key>PartTwo.xcscheme</key>
<dict>
<key>orderHint</key>
<integer>0</integer>
</dict>
</dict>
<key>SuppressBuildableAutocreation</key>
<dict>
<key>8DD103431BA66E0900CE483B</key>
<dict>
<key>primary</key>
<true/>
</dict>
<key>8DD1035C1BA66E0900CE483B</key>
<dict>
<key>primary</key>
<true/>
</dict>
<key>8DD103671BA66E0900CE483B</key>
<dict>
<key>primary</key>
<true/>
</dict>
</dict>
</dict>
</plist>
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="14E46" 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="Djj-nm-mNM">
<rect key="frame" x="200" y="175" width="200" height="250"/>
<color key="backgroundColor" red="0.93725490199999995" green="0.93725490199999995" blue="0.95686274510000002" alpha="1" colorSpace="calibratedRGB"/>
<constraints>
<constraint firstAttribute="height" constant="250" id="gxk-ak-DHC"/>
<constraint firstAttribute="width" constant="200" id="kbP-2Y-sRG"/>
</constraints>
</view>
</subviews>
<color key="backgroundColor" white="1" alpha="1" colorSpace="custom" customColorSpace="calibratedWhite"/>
<constraints>
<constraint firstItem="Djj-nm-mNM" firstAttribute="centerX" secondItem="8bC-Xf-vdC" secondAttribute="centerX" id="7VB-RS-mlL"/>
<constraint firstItem="Djj-nm-mNM" firstAttribute="centerY" secondItem="8bC-Xf-vdC" secondAttribute="centerY" id="pWU-yI-sVU"/>
</constraints>
</view>
<connections>
<outlet property="customViewContainer" destination="Djj-nm-mNM" id="uu6-5f-0au"/>
</connections>
</viewController>
<placeholder placeholderIdentifier="IBFirstResponder" id="dkx-z0-nzr" sceneMemberID="firstResponder"/>
</objects>
<point key="canvasLocation" x="245" y="325"/>
</scene>
</scenes>
</document>
16 changes: 16 additions & 0 deletions PartTwo/PartTwo/CustomView.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
//
// CustomView.h
// PartTwo
//
// Created by Daniel Distant on 9/18/15.
// Copyright © 2015 Mike Kavouras. All rights reserved.
//

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

@interface CustomView : UIView

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

@end
42 changes: 42 additions & 0 deletions PartTwo/PartTwo/CustomView.m
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
//
// CustomView.m
// PartTwo
//
// Created by Daniel Distant on 9/18/15.
// Copyright © 2015 Mike Kavouras. All rights reserved.
//

#import "CustomView.h"

@implementation CustomView

-(void)socialMediaViewDidTapLikeButton:(CustomView *)view {
[self.delegate socialMediaViewDidTapLikeButton:view];
}

-(void)socialMediaViewDidTapCommentButton:(CustomView *)view {
[self.delegate socialMediaViewDidTapCommentButton:view];
}

-(void)socialMediaViewDidTapShareButton:(CustomView *)view {
[self.delegate socialMediaViewDidTapShareButton:view];
}

- (IBAction)likeButtonTapped:(id)sender {
CustomView *view = [[CustomView alloc] init];
Copy link
Contributor

Choose a reason for hiding this comment

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

I'm not sure what you're trying to do by creating a new instance of CustomView. You should not do that and you should just pass self as the parameter in socialMediaViewDidTapLikeButton.

[self socialMediaViewDidTapLikeButton:view];
Copy link
Contributor

Choose a reason for hiding this comment

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

There's no need call another method on self if that other method is only one line of code. You're not making it easier on yourself. Just go ahead and call the delegate directly in this method.

}

- (IBAction)commentButtonTapped:(id)sender {
CustomView *view = [[CustomView alloc] init];
[self socialMediaViewDidTapCommentButton:view];
}

- (IBAction)shareButtonTapped:(id)sender {
CustomView *view = [[CustomView alloc] init];
[self socialMediaViewDidTapShareButton:view];
}



@end
60 changes: 60 additions & 0 deletions PartTwo/PartTwo/CustomView.xib
Original file line number Diff line number Diff line change
@@ -0,0 +1,60 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<document type="com.apple.InterfaceBuilder3.CocoaTouch.XIB" version="3.0" toolsVersion="8191" systemVersion="14E46" 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 alpha="0.65000000000000002" contentMode="scaleToFill" id="iN0-l3-epB" customClass="CustomView">
<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="ZbH-t4-lvi">
<rect key="frame" x="0.0" y="200" width="600" height="200"/>
<color key="backgroundColor" red="0.93725490199999995" green="0.93725490199999995" blue="0.95686274510000002" alpha="1" colorSpace="calibratedRGB"/>
<state key="normal" title="Comment"/>
<connections>
<action selector="commentButtonTapped:" destination="iN0-l3-epB" eventType="touchUpInside" id="lxO-VQ-nCi"/>
</connections>
</button>
<button opaque="NO" contentMode="scaleToFill" contentHorizontalAlignment="center" contentVerticalAlignment="center" buttonType="roundedRect" lineBreakMode="middleTruncation" translatesAutoresizingMaskIntoConstraints="NO" id="0i6-8C-Ler">
<rect key="frame" x="0.0" y="0.0" width="600" height="200"/>
<color key="backgroundColor" red="0.93725490199999995" green="0.93725490199999995" blue="0.95686274510000002" alpha="1" colorSpace="calibratedRGB"/>
<state key="normal" title="Like"/>
<connections>
<action selector="likeButtonTapped:" destination="iN0-l3-epB" eventType="touchUpInside" id="WCQ-Fr-ur9"/>
</connections>
</button>
<button opaque="NO" contentMode="scaleToFill" contentHorizontalAlignment="center" contentVerticalAlignment="center" buttonType="roundedRect" lineBreakMode="middleTruncation" translatesAutoresizingMaskIntoConstraints="NO" id="dzD-1F-WNZ">
<rect key="frame" x="0.0" y="400" width="600" height="200"/>
<color key="backgroundColor" red="0.93725490199999995" green="0.93725490199999995" blue="0.95686274510000002" alpha="1" colorSpace="calibratedRGB"/>
<state key="normal" title="Share"/>
<connections>
<action selector="shareButtonTapped:" destination="iN0-l3-epB" eventType="touchUpInside" id="fAT-lv-LBw"/>
</connections>
</button>
</subviews>
<color key="backgroundColor" white="1" alpha="1" colorSpace="custom" customColorSpace="calibratedWhite"/>
<constraints>
<constraint firstItem="0i6-8C-Ler" firstAttribute="height" secondItem="ZbH-t4-lvi" secondAttribute="height" id="3P0-jV-Vrm"/>
<constraint firstItem="ZbH-t4-lvi" firstAttribute="top" secondItem="0i6-8C-Ler" secondAttribute="bottom" id="5Y6-rO-883"/>
<constraint firstAttribute="bottom" secondItem="dzD-1F-WNZ" secondAttribute="bottom" id="6ME-MZ-VlV"/>
<constraint firstItem="dzD-1F-WNZ" firstAttribute="top" secondItem="ZbH-t4-lvi" secondAttribute="bottom" id="FSU-LK-Jxc"/>
<constraint firstAttribute="trailing" secondItem="dzD-1F-WNZ" secondAttribute="trailing" id="L25-EF-NcI"/>
<constraint firstAttribute="trailing" secondItem="0i6-8C-Ler" secondAttribute="trailing" id="PrO-2Y-0lW"/>
<constraint firstItem="dzD-1F-WNZ" firstAttribute="top" secondItem="ZbH-t4-lvi" secondAttribute="bottom" id="ZCz-Pg-LGp"/>
<constraint firstAttribute="trailing" secondItem="ZbH-t4-lvi" secondAttribute="trailing" id="eHP-Tu-A85"/>
<constraint firstItem="dzD-1F-WNZ" firstAttribute="leading" secondItem="iN0-l3-epB" secondAttribute="leading" id="fh1-nJ-1cs"/>
<constraint firstItem="ZbH-t4-lvi" firstAttribute="top" secondItem="0i6-8C-Ler" secondAttribute="bottom" id="gNI-er-jpf"/>
<constraint firstItem="ZbH-t4-lvi" firstAttribute="leading" secondItem="iN0-l3-epB" secondAttribute="leading" id="ofz-yg-1bt"/>
<constraint firstItem="0i6-8C-Ler" firstAttribute="top" secondItem="iN0-l3-epB" secondAttribute="top" id="pqo-6U-hIt"/>
<constraint firstItem="0i6-8C-Ler" firstAttribute="width" secondItem="dzD-1F-WNZ" secondAttribute="width" id="r7u-mn-Mh0"/>
<constraint firstItem="0i6-8C-Ler" firstAttribute="width" secondItem="ZbH-t4-lvi" secondAttribute="width" id="txA-Tv-X69"/>
<constraint firstItem="0i6-8C-Ler" firstAttribute="height" secondItem="dzD-1F-WNZ" secondAttribute="height" id="vmo-Z1-bHe"/>
<constraint firstItem="0i6-8C-Ler" firstAttribute="leading" secondItem="iN0-l3-epB" secondAttribute="leading" id="xca-S9-HSO"/>
</constraints>
</view>
</objects>
</document>
Loading