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

completed homework! #14

Open
wants to merge 7 commits 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.
11 changes: 11 additions & 0 deletions PartTwo/PartTwo.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
objects = {

/* Begin PBXBuildFile section */
4D0B9D241BA77BC70089A001 /* SocialMediaView.m in Sources */ = {isa = PBXBuildFile; fileRef = 4D0B9D231BA77BC70089A001 /* SocialMediaView.m */; };
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 +36,9 @@
/* End PBXContainerItemProxy section */

/* Begin PBXFileReference section */
4D0B9D211BA77BA60089A001 /* ButtonPressedProtocol.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ButtonPressedProtocol.h; sourceTree = "<group>"; };
4D0B9D221BA77BC70089A001 /* SocialMediaView.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SocialMediaView.h; sourceTree = "<group>"; };
4D0B9D231BA77BC70089A001 /* SocialMediaView.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = SocialMediaView.m; 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 +109,9 @@
8DD1034B1BA66E0900CE483B /* AppDelegate.m */,
8DD1034D1BA66E0900CE483B /* ViewController.h */,
8DD1034E1BA66E0900CE483B /* ViewController.m */,
4D0B9D221BA77BC70089A001 /* SocialMediaView.h */,
4D0B9D231BA77BC70089A001 /* SocialMediaView.m */,
4D0B9D211BA77BA60089A001 /* ButtonPressedProtocol.h */,
8DD103501BA66E0900CE483B /* Main.storyboard */,
8DD103531BA66E0900CE483B /* Assets.xcassets */,
8DD103551BA66E0900CE483B /* LaunchScreen.storyboard */,
Expand Down Expand Up @@ -272,6 +279,7 @@
files = (
8DD1034F1BA66E0900CE483B /* ViewController.m in Sources */,
8DD1034C1BA66E0900CE483B /* AppDelegate.m in Sources */,
4D0B9D241BA77BC70089A001 /* SocialMediaView.m in Sources */,
8DD103491BA66E0900CE483B /* main.m in Sources */,
);
runOnlyForDeploymentPostprocessing = 0;
Expand Down Expand Up @@ -498,6 +506,7 @@
8DD103731BA66E0900CE483B /* Release */,
);
defaultConfigurationIsVisible = 0;
defaultConfigurationName = Release;
};
8DD103741BA66E0900CE483B /* Build configuration list for PBXNativeTarget "PartTwoTests" */ = {
isa = XCConfigurationList;
Expand All @@ -506,6 +515,7 @@
8DD103761BA66E0900CE483B /* Release */,
);
defaultConfigurationIsVisible = 0;
defaultConfigurationName = Release;
};
8DD103771BA66E0900CE483B /* Build configuration list for PBXNativeTarget "PartTwoUITests" */ = {
isa = XCConfigurationList;
Expand All @@ -514,6 +524,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 = "0710"
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>
80 changes: 76 additions & 4 deletions PartTwo/PartTwo/Base.lproj/Main.storyboard
Original file line number Diff line number Diff line change
@@ -1,25 +1,97 @@
<?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"/>
<capability name="Constraints to layout margins" minToolsVersion="6.0"/>
</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"/>
<color key="backgroundColor" white="1" alpha="1" colorSpace="custom" customColorSpace="calibratedWhite"/>
<subviews>
<view contentMode="scaleToFill" translatesAutoresizingMaskIntoConstraints="NO" id="2h0-K1-aFW" customClass="SocialMediaView">
<rect key="frame" x="120" y="120" width="360" height="380"/>
<subviews>
<button opaque="NO" contentMode="scaleToFill" contentHorizontalAlignment="center" contentVerticalAlignment="center" buttonType="roundedRect" lineBreakMode="middleTruncation" translatesAutoresizingMaskIntoConstraints="NO" id="Ih8-o2-2CC">
<rect key="frame" x="140" y="175" width="80" height="30"/>
<color key="backgroundColor" red="0.2196078431372549" green="0.29803921568627451" blue="0.5725490196078431" alpha="1" colorSpace="calibratedRGB"/>
<constraints>
<constraint firstAttribute="width" constant="80" id="Q3z-JY-2Wy"/>
</constraints>
<fontDescription key="fontDescription" name="Helvetica" family="Helvetica" pointSize="15"/>
<state key="normal" title=" Like ">
<color key="titleColor" white="1" alpha="1" colorSpace="calibratedWhite"/>
</state>
<connections>
<action selector="likeButtonTapped:" destination="2h0-K1-aFW" eventType="touchUpInside" id="yYp-bb-NhT"/>
</connections>
</button>
<button opaque="NO" contentMode="scaleToFill" contentHorizontalAlignment="center" contentVerticalAlignment="center" buttonType="roundedRect" lineBreakMode="middleTruncation" translatesAutoresizingMaskIntoConstraints="NO" id="TuS-Tq-Ozx">
<rect key="frame" x="140" y="95" width="80" height="30"/>
<color key="backgroundColor" red="0.2196078431372549" green="0.29803921568627451" blue="0.5725490196078431" alpha="1" colorSpace="calibratedRGB"/>
<constraints>
<constraint firstAttribute="width" constant="80" id="98g-UW-6vO"/>
<constraint firstAttribute="height" constant="30" id="Qbg-CQ-3dM"/>
</constraints>
<fontDescription key="fontDescription" name="Helvetica" family="Helvetica" pointSize="15"/>
<state key="normal" title=" Comment ">
<color key="titleColor" white="1" alpha="1" colorSpace="calibratedWhite"/>
</state>
<connections>
<action selector="commentButtonTapped:" destination="2h0-K1-aFW" eventType="touchUpInside" id="DJG-RW-QSC"/>
</connections>
</button>
<button opaque="NO" contentMode="scaleToFill" contentHorizontalAlignment="center" contentVerticalAlignment="center" buttonType="roundedRect" lineBreakMode="middleTruncation" translatesAutoresizingMaskIntoConstraints="NO" id="74p-Pk-pia">
<rect key="frame" x="140" y="255" width="80" height="30"/>
<color key="backgroundColor" red="0.2196078431372549" green="0.29803921568627451" blue="0.5725490196078431" alpha="1" colorSpace="calibratedRGB"/>
<constraints>
<constraint firstAttribute="width" constant="80" id="WM5-fA-K8p"/>
<constraint firstAttribute="height" constant="30" id="bP3-Yw-pnl"/>
</constraints>
<fontDescription key="fontDescription" name="Helvetica" family="Helvetica" pointSize="15"/>
<state key="normal" title=" Share ">
<color key="titleColor" white="1" alpha="1" colorSpace="calibratedWhite"/>
</state>
<connections>
<action selector="shareButtonTapped:" destination="2h0-K1-aFW" eventType="touchUpInside" id="bnS-AT-8a6"/>
</connections>
</button>
</subviews>
<color key="backgroundColor" white="1" alpha="1" colorSpace="calibratedWhite"/>
<constraints>
<constraint firstItem="74p-Pk-pia" firstAttribute="centerX" secondItem="2h0-K1-aFW" secondAttribute="centerX" id="36X-VE-Sd5"/>
<constraint firstItem="Ih8-o2-2CC" firstAttribute="centerY" secondItem="2h0-K1-aFW" secondAttribute="centerY" id="HhM-lw-eTM"/>
<constraint firstItem="Ih8-o2-2CC" firstAttribute="centerX" secondItem="2h0-K1-aFW" secondAttribute="centerX" id="emH-mF-B7u"/>
<constraint firstItem="Ih8-o2-2CC" firstAttribute="top" secondItem="TuS-Tq-Ozx" secondAttribute="bottom" constant="50" id="fer-S8-4cP"/>
<constraint firstItem="74p-Pk-pia" firstAttribute="top" secondItem="Ih8-o2-2CC" secondAttribute="bottom" constant="50" id="tvF-Pn-1M1"/>
<constraint firstItem="TuS-Tq-Ozx" firstAttribute="centerX" secondItem="2h0-K1-aFW" secondAttribute="centerX" id="y1g-0l-XrV"/>
</constraints>
</view>
</subviews>
<color key="backgroundColor" red="0.93725490199999995" green="0.93725490199999995" blue="0.95686274510000002" alpha="1" colorSpace="calibratedRGB"/>
<constraints>
<constraint firstItem="wfy-db-euE" firstAttribute="top" secondItem="2h0-K1-aFW" secondAttribute="bottom" constant="100" id="S3p-Lj-EIH"/>
<constraint firstItem="2h0-K1-aFW" firstAttribute="leading" secondItem="8bC-Xf-vdC" secondAttribute="leadingMargin" constant="100" id="VUu-XI-Rt2"/>
<constraint firstItem="2h0-K1-aFW" firstAttribute="top" secondItem="y3c-jy-aDJ" secondAttribute="bottom" constant="100" id="yuf-7U-3Hw"/>
<constraint firstAttribute="trailingMargin" secondItem="2h0-K1-aFW" secondAttribute="trailing" constant="100" id="zaT-R1-rla"/>
</constraints>
</view>
<connections>
<outlet property="socialMediaView" destination="2h0-K1-aFW" id="3Ji-Oc-KtK"/>
</connections>
</viewController>
<placeholder placeholderIdentifier="IBFirstResponder" id="dkx-z0-nzr" sceneMemberID="firstResponder"/>
</objects>
<point key="canvasLocation" x="282" y="429"/>
</scene>
</scenes>
</document>
21 changes: 21 additions & 0 deletions PartTwo/PartTwo/ButtonPressedProtocol.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
//
// ButtonPressedProtocol.h
// PartTwo
//
// Created by Shena Yoshida on 9/14/15.
// Copyright © 2015 Mike Kavouras. All rights reserved.
//

#import <Foundation/Foundation.h>

@class SocialMediaView;

@protocol ButtonPressedProtocol <NSObject>

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

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

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

@end
18 changes: 18 additions & 0 deletions PartTwo/PartTwo/SocialMediaView.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
//
// SocialMediaView.h
// PartTwo
//
// Created by Shena Yoshida on 9/14/15.
// Copyright © 2015 Mike Kavouras. All rights reserved.
//

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

extern NSString * const MyCustomNotificationName; // public constant declaration for notification name

@interface SocialMediaView : UIView

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

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

#import "SocialMediaView.h"

NSString * const MyCustomNotificationName = @"MyCustomNotification"; // declare constant for notification and set string

@interface SocialMediaView ()

@end

@implementation SocialMediaView

// required delegate methods:
- (IBAction)commentButtonTapped:(UIButton *)sender {
[self.delegate socialMediaViewDidTapCommentButton:self]; // connect delegate, when this button is tapped, pass message.
}

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

- (IBAction)shareButtonTapped:(UIButton *)sender {
// [self.delegate socialMediaViewDidTapShareButton:self];

[[NSNotificationCenter defaultCenter] postNotificationName:MyCustomNotificationName object:nil]; // broadcasting notification
}

@end
Loading