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
13 changes: 11 additions & 2 deletions Seasonizer.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -138,6 +138,7 @@
TargetAttributes = {
87549C3E1B34067200CD1868 = {
CreatedOnToolsVersion = 6.3.2;
DevelopmentTeam = LS389VJ9WF;
};
};
};
Expand Down Expand Up @@ -276,10 +277,14 @@
buildSettings = {
ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
CODE_SIGN_IDENTITY = "iPhone Developer";
"CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer";
INFOPLIST_FILE = Seasonizer/Info.plist;
IPHONEOS_DEPLOYMENT_TARGET = 9.1;
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks";
PRODUCT_BUNDLE_IDENTIFIER = "de.uni-heidelberg.ios-dev-kurs.seasonizer";
PRODUCT_BUNDLE_IDENTIFIER = "de.uni-heidelberg.ios-dev-kurs.colin.seasonizer";
PRODUCT_NAME = "$(TARGET_NAME)";
PROVISIONING_PROFILE = "";
TARGETED_DEVICE_FAMILY = "1,2";
};
name = Debug;
};
Expand All @@ -288,10 +293,14 @@
buildSettings = {
ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
CODE_SIGN_IDENTITY = "iPhone Developer";
"CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer";
INFOPLIST_FILE = Seasonizer/Info.plist;
IPHONEOS_DEPLOYMENT_TARGET = 9.1;
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks";
PRODUCT_BUNDLE_IDENTIFIER = "de.uni-heidelberg.ios-dev-kurs.seasonizer";
PRODUCT_BUNDLE_IDENTIFIER = "de.uni-heidelberg.ios-dev-kurs.colin.seasonizer";
PRODUCT_NAME = "$(TARGET_NAME)";
PROVISIONING_PROFILE = "";
TARGETED_DEVICE_FAMILY = "1,2";
};
name = Release;
};
Expand Down
28 changes: 25 additions & 3 deletions Seasonizer/AccessoryListViewController.swift
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,15 @@ class AccessoryListViewController: UITableViewController {
var accessories: [Accessory]?
var selectedAccessory: Accessory?

private var indexOfSelectedAccessory = 0

override func prepareForSegue(segue: UIStoryboardSegue, sender: AnyObject?) {
if segue.identifier == "selectedAccessory" {
guard let indexPath = tableView.indexPathForSelectedRow else {return }
selectedAccessory = accessories![indexPath.row]
}
}

// MARK: User Interaction

// TODO: Implement `prepareForSegue(_:sender:)` to set `selectedAccessory` when the "selectedAccessory" Segue is performed.
Expand All @@ -28,10 +36,24 @@ class AccessoryListViewController: UITableViewController {
}

*/

}



// MARK: - Table View Data Source

// TODO: Implement the `UITableViewDataSource` protocol.
override func numberOfSectionsInTableView(tableView: UITableView) -> Int {
return 1
}

override func tableView(tableView: UITableView, numberOfRowsInSection section: Int) -> Int {
return (accessories?.count)!
}

override func tableView(tableView: UITableView, cellForRowAtIndexPath indexPath: NSIndexPath) -> UITableViewCell {
let cell = tableView.dequeueReusableCellWithIdentifier("AccessoryCell", forIndexPath: indexPath) as UITableViewCell

cell.imageView!.image = accessories![indexPath.row].image
cell.textLabel!.text = accessories![indexPath.row].title
return cell
}
}
29 changes: 27 additions & 2 deletions Seasonizer/CanvasViewController.swift
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,6 @@ class CanvasViewController: UIViewController, UINavigationControllerDelegate, UI
/// Eine View, die _über_ der `photoImageView` positioniert ist und die Accessories anzeigt.
@IBOutlet weak var accessoryOverlayView: UIView!


// MARK: Accessory Handling

/// Displays the accessory view on the canvas and enables user interaction with it.
Expand Down Expand Up @@ -72,6 +71,7 @@ class CanvasViewController: UIViewController, UINavigationControllerDelegate, UI
return renderedPicture
}

var selectedAccessory : Accessory?

// MARK: User Interaction

Expand Down Expand Up @@ -118,6 +118,15 @@ class CanvasViewController: UIViewController, UINavigationControllerDelegate, UI
self.presentViewController(activityViewController, animated: true, completion: nil)
}

override func prepareForSegue(segue: UIStoryboardSegue, sender: AnyObject?) {
switch segue.identifier! {
case "AccessoryView":
guard let accessoryListViewController = (segue.destinationViewController as? UINavigationController)?.topViewController as? AccessoryListViewController else {break}
accessoryListViewController.accessories = allAccessories
default:
break
}
}

// TODO: Implement `prepareForSegue(_:sender:)` to pass `allAccessories` on to `AccessoryListViewController`.
/*
Expand All @@ -128,7 +137,6 @@ class CanvasViewController: UIViewController, UINavigationControllerDelegate, UI
}
*/


// TODO: Implement an `@IBAction func unwindToCanvas(segue: UIStoryboardSegue)` Unwing Segue that the `AccessoryListViewController` can exit to.

// TODO: For the "selectedAccessory" segue, obtain the selected accessory and add it to the canvas.
Expand All @@ -151,6 +159,23 @@ class CanvasViewController: UIViewController, UINavigationControllerDelegate, UI

self.addAccessoryView(accessoryView)
*/

@IBAction func unwindToCanvas (segue: UIStoryboardSegue) {
switch segue.identifier! {
case "selectedAccessory":
guard let accessoryListViewController = segue.sourceViewController as? AccessoryListViewController,
selectedAccessory = accessoryListViewController.selectedAccessory else {
break
}
let accessoryView = AccessoryView(accessory: selectedAccessory)
accessoryView.center = accessoryOverlayView.convertPoint(accessoryOverlayView.center, fromView: accessoryOverlayView.superview)
addAccessoryView(accessoryView)
case "ExitFromButton":
break
default:
break
}
}

}

Expand Down
123 changes: 119 additions & 4 deletions Seasonizer/Main.storyboard
100644 → 100755
Original file line number Diff line number Diff line change
@@ -1,7 +1,9 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<document type="com.apple.InterfaceBuilder3.CocoaTouch.Storyboard.XIB" version="3.0" toolsVersion="10117" systemVersion="15E65" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" useTraitCollections="YES" initialViewController="A6u-BR-TcU">
<dependencies>
<deployment identifier="iOS"/>
<plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="10085"/>
<capability name="Constraints to layout margins" minToolsVersion="6.0"/>
</dependencies>
<scenes>
<!--Seasonizer-->
Expand All @@ -15,14 +17,127 @@
<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>
<imageView userInteractionEnabled="NO" contentMode="scaleToFill" horizontalHuggingPriority="251" verticalHuggingPriority="251" translatesAutoresizingMaskIntoConstraints="NO" id="HZb-V9-xRe">
<rect key="frame" x="0.0" y="59" width="600" height="497"/>
</imageView>
<view contentMode="scaleToFill" translatesAutoresizingMaskIntoConstraints="NO" id="XTl-p8-0ty">
<rect key="frame" x="0.0" y="64" width="600" height="492"/>
<color key="backgroundColor" white="0.0" alpha="0.0" colorSpace="calibratedWhite"/>
</view>
</subviews>
<color key="backgroundColor" white="1" alpha="1" colorSpace="custom" customColorSpace="calibratedWhite"/>
<constraints>
<constraint firstItem="HZb-V9-xRe" firstAttribute="leading" secondItem="8bC-Xf-vdC" secondAttribute="leading" id="0JT-bv-991"/>
<constraint firstItem="XTl-p8-0ty" firstAttribute="top" secondItem="y3c-jy-aDJ" secondAttribute="bottom" id="2M9-Qj-jZq"/>
<constraint firstItem="HZb-V9-xRe" firstAttribute="top" secondItem="8bC-Xf-vdC" secondAttribute="topMargin" constant="59" id="7I1-EC-Pu1"/>
<constraint firstAttribute="trailing" secondItem="HZb-V9-xRe" secondAttribute="trailing" id="EZ6-iK-XaD"/>
<constraint firstItem="HZb-V9-xRe" firstAttribute="trailing" secondItem="XTl-p8-0ty" secondAttribute="trailing" id="JJW-Aq-aC9"/>
<constraint firstItem="HZb-V9-xRe" firstAttribute="bottom" secondItem="wfy-db-euE" secondAttribute="top" id="Yc7-1v-YIe"/>
<constraint firstItem="HZb-V9-xRe" firstAttribute="leading" secondItem="XTl-p8-0ty" secondAttribute="leading" id="jsh-e1-gID"/>
<constraint firstItem="XTl-p8-0ty" firstAttribute="bottom" secondItem="wfy-db-euE" secondAttribute="top" id="mOV-Jk-NhY"/>
</constraints>
</view>
<toolbarItems/>
<navigationItem key="navigationItem" title="Seasonizer" id="6dS-Kq-rKs"/>
<toolbarItems>
<barButtonItem systemItem="trash" id="rh7-fO-94o">
<connections>
<action selector="trashButtonPressed:" destination="BYZ-38-t0r" id="JVP-y9-KF5"/>
</connections>
</barButtonItem>
<barButtonItem style="plain" systemItem="flexibleSpace" id="kCx-Vb-FRn"/>
<barButtonItem systemItem="camera" id="VmE-RM-Jue">
<connections>
<action selector="cameraButtonPressed:" destination="BYZ-38-t0r" id="eou-hJ-6kL"/>
</connections>
</barButtonItem>
<barButtonItem style="plain" systemItem="flexibleSpace" id="Wz4-u0-cZj"/>
<barButtonItem title="Accessories" id="ys6-Fa-can">
<connections>
<segue destination="Frv-hR-OcH" kind="presentation" identifier="AccessoryView" modalTransitionStyle="coverVertical" id="hor-YU-AHP"/>
</connections>
</barButtonItem>
</toolbarItems>
<navigationItem key="navigationItem" title="Seasonizer" id="6dS-Kq-rKs">
<barButtonItem key="rightBarButtonItem" systemItem="action" id="dgm-ZT-gQR">
<connections>
<action selector="actionButtonPressed:" destination="BYZ-38-t0r" id="0fU-gO-50b"/>
</connections>
</barButtonItem>
</navigationItem>
<connections>
<outlet property="accessoryOverlayView" destination="XTl-p8-0ty" id="JSh-q1-yuB"/>
<outlet property="photoImageView" destination="HZb-V9-xRe" id="FUU-Ro-YJa"/>
</connections>
</viewController>
<placeholder placeholderIdentifier="IBFirstResponder" id="dkx-z0-nzr" sceneMemberID="firstResponder"/>
</objects>
<point key="canvasLocation" x="1010" y="136"/>
<point key="canvasLocation" x="1054" y="136"/>
</scene>
<!--Accessories-->
<scene sceneID="lbw-2H-ngA">
<objects>
<tableViewController id="PeH-ce-wdS" customClass="AccessoryListViewController" customModule="Seasonizer" customModuleProvider="target" sceneMemberID="viewController">
<tableView key="view" clipsSubviews="YES" contentMode="scaleToFill" alwaysBounceVertical="YES" dataMode="prototypes" style="plain" separatorStyle="default" rowHeight="44" sectionHeaderHeight="28" sectionFooterHeight="28" id="2jr-0k-mZ4">
<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="calibratedWhite"/>
<prototypes>
<tableViewCell clipsSubviews="YES" contentMode="scaleToFill" restorationIdentifier="AccessoryCell" selectionStyle="default" indentationWidth="10" reuseIdentifier="AccessoryCell" textLabel="wQD-bB-oQW" style="IBUITableViewCellStyleDefault" id="7Qo-xs-X2Z">
<rect key="frame" x="0.0" y="92" width="600" height="44"/>
<autoresizingMask key="autoresizingMask"/>
<tableViewCellContentView key="contentView" opaque="NO" clipsSubviews="YES" multipleTouchEnabled="YES" contentMode="center" tableViewCell="7Qo-xs-X2Z" id="cTI-Pb-dZn">
<rect key="frame" x="0.0" y="0.0" width="600" height="43"/>
<autoresizingMask key="autoresizingMask"/>
<subviews>
<label opaque="NO" multipleTouchEnabled="YES" contentMode="left" text="Title" textAlignment="natural" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" id="wQD-bB-oQW">
<rect key="frame" x="15" y="0.0" width="570" height="43"/>
<autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMaxY="YES"/>
<fontDescription key="fontDescription" type="system" pointSize="16"/>
<color key="textColor" red="0.0" green="0.0" blue="0.0" alpha="1" colorSpace="calibratedRGB"/>
<nil key="highlightedColor"/>
</label>
</subviews>
</tableViewCellContentView>
<connections>
<segue destination="4L3-zo-L4f" kind="unwind" identifier="selectedAccessory" unwindAction="unwindToCanvas:" id="VXX-od-U1O"/>
</connections>
</tableViewCell>
</prototypes>
<connections>
<outlet property="dataSource" destination="PeH-ce-wdS" id="Egh-nT-xmK"/>
<outlet property="delegate" destination="PeH-ce-wdS" id="kjD-5X-PCc"/>
</connections>
</tableView>
<toolbarItems/>
<navigationItem key="navigationItem" title="Accessories" id="QbZ-xo-0FX">
<barButtonItem key="rightBarButtonItem" systemItem="cancel" id="opM-Ue-JJ7">
<connections>
<segue destination="4L3-zo-L4f" kind="unwind" identifier="ExitFromButton" unwindAction="unwindToCanvas:" id="0By-2Z-pek"/>
</connections>
</barButtonItem>
</navigationItem>
<simulatedToolbarMetrics key="simulatedBottomBarMetrics"/>
</tableViewController>
<placeholder placeholderIdentifier="IBFirstResponder" id="Kbo-AW-Lbs" userLabel="First Responder" sceneMemberID="firstResponder"/>
<exit id="4L3-zo-L4f" userLabel="Exit" sceneMemberID="exit"/>
</objects>
<point key="canvasLocation" x="2548" y="136"/>
</scene>
<!--Navigation Controller-->
<scene sceneID="yzR-6f-KZA">
<objects>
<navigationController id="Frv-hR-OcH" sceneMemberID="viewController">
<navigationBar key="navigationBar" contentMode="scaleToFill" id="n6p-Gt-fhI">
<rect key="frame" x="0.0" y="0.0" width="320" height="44"/>
<autoresizingMask key="autoresizingMask"/>
</navigationBar>
<connections>
<segue destination="PeH-ce-wdS" kind="relationship" relationship="rootViewController" id="lKh-uj-eSc"/>
</connections>
</navigationController>
<placeholder placeholderIdentifier="IBFirstResponder" id="3KB-YV-tdl" userLabel="First Responder" sceneMemberID="firstResponder"/>
</objects>
<point key="canvasLocation" x="1736" y="-300"/>
</scene>
<!--Navigation Controller-->
<scene sceneID="WSz-3O-Obv">
Expand All @@ -44,7 +159,7 @@
</navigationController>
<placeholder placeholderIdentifier="IBFirstResponder" id="GSV-sV-N3u" userLabel="First Responder" sceneMemberID="firstResponder"/>
</objects>
<point key="canvasLocation" x="258" y="136"/>
<point key="canvasLocation" x="318" y="136"/>
</scene>
</scenes>
</document>