add Story Detail View Controller

This commit is contained in:
ylzheng
2015-08-03 20:54:00 +08:00
parent 8b9a8089a2
commit 6ae79a5c95
4 changed files with 86 additions and 7 deletions
+4
View File
@@ -15,6 +15,7 @@
452DC1231B6287E600847691 /* Images.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = 452DC1221B6287E600847691 /* Images.xcassets */; };
452DC1261B6287E600847691 /* LaunchScreen.xib in Resources */ = {isa = PBXBuildFile; fileRef = 452DC1241B6287E600847691 /* LaunchScreen.xib */; };
452DC1321B6287E600847691 /* librxTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = 452DC1311B6287E600847691 /* librxTests.swift */; };
4545581E1B6F994200FB7839 /* DetailViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 4545581D1B6F994200FB7839 /* DetailViewController.swift */; };
45CF60111B67937000CA7F06 /* Alamofire.framework in Embed Frameworks */ = {isa = PBXBuildFile; fileRef = 45CF60011B67929600CA7F06 /* Alamofire.framework */; settings = {ATTRIBUTES = (CodeSignOnCopy, RemoveHeadersOnCopy, ); }; };
45CF60431B67C3A400CA7F06 /* ContainerViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 45CF60421B67C3A400CA7F06 /* ContainerViewController.swift */; };
45CF60481B67C3D900CA7F06 /* StorysTableViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 45CF60471B67C3D900CA7F06 /* StorysTableViewController.swift */; };
@@ -108,6 +109,7 @@
452DC12B1B6287E600847691 /* librxTests.xctest */ = {isa = PBXFileReference; explicitFileType = wrapper.cfbundle; includeInIndex = 0; path = librxTests.xctest; sourceTree = BUILT_PRODUCTS_DIR; };
452DC1301B6287E600847691 /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = "<group>"; };
452DC1311B6287E600847691 /* librxTests.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = librxTests.swift; sourceTree = "<group>"; };
4545581D1B6F994200FB7839 /* DetailViewController.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = DetailViewController.swift; sourceTree = "<group>"; };
45CF5FF71B67929600CA7F06 /* Alamofire.xcodeproj */ = {isa = PBXFileReference; lastKnownFileType = "wrapper.pb-project"; name = Alamofire.xcodeproj; path = externals/Alamofire/Alamofire.xcodeproj; sourceTree = "<group>"; };
45CF60421B67C3A400CA7F06 /* ContainerViewController.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = ContainerViewController.swift; sourceTree = "<group>"; };
45CF60471B67C3D900CA7F06 /* StorysTableViewController.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = StorysTableViewController.swift; sourceTree = "<group>"; };
@@ -212,6 +214,7 @@
452DC11D1B6287E600847691 /* ViewController.swift */,
45CF60421B67C3A400CA7F06 /* ContainerViewController.swift */,
45CF60471B67C3D900CA7F06 /* StorysTableViewController.swift */,
4545581D1B6F994200FB7839 /* DetailViewController.swift */,
);
name = controllers;
sourceTree = "<group>";
@@ -421,6 +424,7 @@
45CF60481B67C3D900CA7F06 /* StorysTableViewController.swift in Sources */,
452DC11C1B6287E600847691 /* librx.xcdatamodeld in Sources */,
451281D41B6F926500C59C6B /* CustomTableCell.swift in Sources */,
4545581E1B6F994200FB7839 /* DetailViewController.swift in Sources */,
);
runOnlyForDeploymentPostprocessing = 0;
};
+43 -2
View File
@@ -59,7 +59,7 @@
<color key="backgroundColor" white="1" alpha="1" colorSpace="calibratedWhite"/>
<inset key="scrollIndicatorInsets" minX="-16" minY="0.0" maxX="-16" maxY="0.0"/>
<prototypes>
<tableViewCell contentMode="scaleToFill" restorationIdentifier="Cell" selectionStyle="default" indentationWidth="10" reuseIdentifier="Cell" rowHeight="80" id="APH-r0-l37" customClass="CustomTableCell" customModule="librx">
<tableViewCell contentMode="scaleToFill" restorationIdentifier="Cell" selectionStyle="default" accessoryType="disclosureIndicator" indentationWidth="10" reuseIdentifier="Cell" rowHeight="80" id="APH-r0-l37" customClass="CustomTableCell" customModule="librx">
<rect key="frame" x="0.0" y="22" width="320" height="44"/>
<autoresizingMask key="autoresizingMask"/>
<tableViewCellContentView key="contentView" opaque="NO" clipsSubviews="YES" multipleTouchEnabled="YES" contentMode="center" tableViewCell="APH-r0-l37" id="OHj-QX-4Gg">
@@ -109,6 +109,7 @@
<outlet property="readNumLabel" destination="Mod-Q5-pbF" id="qvn-LE-QIm"/>
<outlet property="shareNumLabel" destination="s71-Ar-Bcb" id="n2v-Pt-U1c"/>
<outlet property="thumbnilImageView" destination="abJ-wu-78S" id="0LX-BI-S42"/>
<segue destination="v9Y-zW-Lg4" kind="push" identifier="showStoryDetail" id="ywS-ia-V0n"/>
</connections>
</tableViewCell>
</prototypes>
@@ -120,7 +121,7 @@
</tableViewController>
<placeholder placeholderIdentifier="IBFirstResponder" id="wQd-t8-Eyc" userLabel="First Responder" sceneMemberID="firstResponder"/>
</objects>
<point key="canvasLocation" x="416" y="1857"/>
<point key="canvasLocation" x="380" y="1881"/>
</scene>
<!--Tab Bar Controller-->
<scene sceneID="1Ev-no-dBa">
@@ -220,6 +221,46 @@
</objects>
<point key="canvasLocation" x="-248" y="1084"/>
</scene>
<!--Detail View Controller-->
<scene sceneID="88J-co-Zz5">
<objects>
<viewController id="v9Y-zW-Lg4" customClass="DetailViewController" customModule="librx" customModuleProvider="target" sceneMemberID="viewController">
<layoutGuides>
<viewControllerLayoutGuide type="top" id="PKv-Zj-e6Y"/>
<viewControllerLayoutGuide type="bottom" id="Rp3-xc-dlG"/>
</layoutGuides>
<view key="view" contentMode="scaleToFill" id="ZwA-Xr-bik">
<rect key="frame" x="0.0" y="0.0" width="320" height="568"/>
<autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
<subviews>
<button opaque="NO" contentMode="scaleToFill" fixedFrame="YES" contentHorizontalAlignment="center" contentVerticalAlignment="center" buttonType="roundedRect" lineBreakMode="middleTruncation" translatesAutoresizingMaskIntoConstraints="NO" id="hnd-7j-PyJ">
<rect key="frame" x="151" y="191" width="46" height="30"/>
<state key="normal" title="Button">
<color key="titleShadowColor" white="0.5" alpha="1" colorSpace="calibratedWhite"/>
</state>
</button>
<label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" fixedFrame="YES" text="StoryName" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="EUu-jR-tNa">
<rect key="frame" x="139" y="125" width="86" height="21"/>
<fontDescription key="fontDescription" type="system" pointSize="17"/>
<color key="textColor" red="0.0" green="0.0" blue="0.0" alpha="1" colorSpace="calibratedRGB"/>
<nil key="highlightedColor"/>
</label>
<imageView userInteractionEnabled="NO" contentMode="scaleToFill" horizontalHuggingPriority="251" verticalHuggingPriority="251" fixedFrame="YES" translatesAutoresizingMaskIntoConstraints="NO" id="dfv-2b-OE7">
<rect key="frame" x="40" y="220" width="240" height="128"/>
</imageView>
</subviews>
<color key="backgroundColor" white="1" alpha="1" colorSpace="calibratedWhite"/>
</view>
<navigationItem key="navigationItem" id="T8D-NU-cAU"/>
<connections>
<outlet property="storyImageView" destination="dfv-2b-OE7" id="LH0-fm-qrP"/>
<outlet property="storyName" destination="EUu-jR-tNa" id="x7z-zg-tc6"/>
</connections>
</viewController>
<placeholder placeholderIdentifier="IBFirstResponder" id="Qam-qU-mNd" userLabel="First Responder" sceneMemberID="firstResponder"/>
</objects>
<point key="canvasLocation" x="836" y="1881"/>
</scene>
</scenes>
<resources>
<image name="Menu" width="12" height="12"/>
+23
View File
@@ -0,0 +1,23 @@
//
// DetailViewController.swift
// librx
//
// Created by Yunlong Zheng on 15/8/3.
// Copyright (c) 2015 librx. All rights reserved.
//
import UIKit
class DetailViewController: UIViewController {
@IBOutlet var storyImageView:UIImageView!
@IBOutlet var storyName:UILabel!
var storyImage:String!
override func viewDidLoad() {
super.viewDidLoad()
self.storyImageView.image = UIImage(named: storyImage)
}
}
+16 -5
View File
@@ -54,14 +54,25 @@ class StorysTableViewController: UITableViewController {
cell.readNumLabel.text = "阅读1024"
cell.commentNumLabel.text = "评论100"
cell.shareNumLabel.text = "分享101"
// cell.textLabel!.text = storys[indexPath.row]
// cell.textLabel!.text = storys[indexPath.row]
// cell.imageView?.image = UIImage(named: storyImages[indexPath.row])
return cell
}
override func prepareForSegue(segue: UIStoryboardSegue, sender: AnyObject?) {
if segue.identifier == "showStoryDetail" {
if let indexPath = self.tableView.indexPathForSelectedRow(){
let destinationController = segue.destinationViewController as! DetailViewController
destinationController.storyImage = self.storyImages[indexPath.row]
}
}
}
}