mirror of
https://github.com/wahyd4/libr-ios.git
synced 2026-08-09 05:06:46 +10:00
探索发现,个人中心
This commit is contained in:
@@ -60,6 +60,9 @@
|
||||
45CF5AD11B8DFD64001E5CFC /* LoginService.swift in Sources */ = {isa = PBXBuildFile; fileRef = 45CF5AD01B8DFD63001E5CFC /* LoginService.swift */; };
|
||||
45CF60481B67C3D900CA7F06 /* StorysTableViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 45CF60471B67C3D900CA7F06 /* StorysTableViewController.swift */; };
|
||||
45D09EB01BDBD375006F91C2 /* LineChart.swift in Sources */ = {isa = PBXBuildFile; fileRef = 45D09EAF1BDBD375006F91C2 /* LineChart.swift */; };
|
||||
45D4B1C91BDCC45900E3FA32 /* ExploreTableCell.swift in Sources */ = {isa = PBXBuildFile; fileRef = 45D4B1C81BDCC45900E3FA32 /* ExploreTableCell.swift */; };
|
||||
45D4B1CB1BDCC55600E3FA32 /* ExploreTableViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 45D4B1CA1BDCC55600E3FA32 /* ExploreTableViewController.swift */; };
|
||||
45D4B1CD1BDCC76600E3FA32 /* ExploreSource.swift in Sources */ = {isa = PBXBuildFile; fileRef = 45D4B1CC1BDCC76600E3FA32 /* ExploreSource.swift */; };
|
||||
45D77BB81BAD14C300618CAC /* RootViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 45D77BB71BAD14C300618CAC /* RootViewController.swift */; };
|
||||
45D8E71D1B71CA6E00A33659 /* Extension.swift in Sources */ = {isa = PBXBuildFile; fileRef = 45D8E71C1B71CA6E00A33659 /* Extension.swift */; };
|
||||
45D8E7241B71E3BA00A33659 /* ProfileViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 45D8E7231B71E3BA00A33659 /* ProfileViewController.swift */; };
|
||||
@@ -182,6 +185,9 @@
|
||||
45CF5AD01B8DFD63001E5CFC /* LoginService.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = LoginService.swift; sourceTree = "<group>"; };
|
||||
45CF60471B67C3D900CA7F06 /* StorysTableViewController.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = StorysTableViewController.swift; sourceTree = "<group>"; };
|
||||
45D09EAF1BDBD375006F91C2 /* LineChart.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = LineChart.swift; sourceTree = "<group>"; };
|
||||
45D4B1C81BDCC45900E3FA32 /* ExploreTableCell.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = ExploreTableCell.swift; sourceTree = "<group>"; };
|
||||
45D4B1CA1BDCC55600E3FA32 /* ExploreTableViewController.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = ExploreTableViewController.swift; sourceTree = "<group>"; };
|
||||
45D4B1CC1BDCC76600E3FA32 /* ExploreSource.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = ExploreSource.swift; sourceTree = "<group>"; };
|
||||
45D77BB71BAD14C300618CAC /* RootViewController.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = RootViewController.swift; sourceTree = "<group>"; };
|
||||
45D8E71C1B71CA6E00A33659 /* Extension.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = Extension.swift; sourceTree = "<group>"; };
|
||||
45D8E7231B71E3BA00A33659 /* ProfileViewController.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = ProfileViewController.swift; sourceTree = "<group>"; };
|
||||
@@ -426,6 +432,7 @@
|
||||
45517B131BCBE743004C6D10 /* ContainerViewController.swift */,
|
||||
45517B151BCCB73D004C6D10 /* GraphsUIViewController.swift */,
|
||||
4544DAD51BCD4358002B6666 /* SettingTableViewController.swift */,
|
||||
45D4B1CA1BDCC55600E3FA32 /* ExploreTableViewController.swift */,
|
||||
);
|
||||
name = controllers;
|
||||
sourceTree = "<group>";
|
||||
@@ -439,6 +446,7 @@
|
||||
45681F331B7F7C8A00D1E096 /* User.swift */,
|
||||
450F9B901BAB09B800D4EF3B /* Explore.swift */,
|
||||
45A50FBF1BC96608009897FF /* Profile.swift */,
|
||||
45D4B1CC1BDCC76600E3FA32 /* ExploreSource.swift */,
|
||||
);
|
||||
name = models;
|
||||
sourceTree = "<group>";
|
||||
@@ -462,6 +470,7 @@
|
||||
451281D31B6F926500C59C6B /* CustomTableCell.swift */,
|
||||
456F1A1D1B6FD4D0007F9ACF /* MenuTableViewCell.swift */,
|
||||
45E713731B9F39A7002FFCBB /* ExploreCell.swift */,
|
||||
45D4B1C81BDCC45900E3FA32 /* ExploreTableCell.swift */,
|
||||
);
|
||||
name = cells;
|
||||
sourceTree = "<group>";
|
||||
@@ -744,6 +753,7 @@
|
||||
455B954E1B94A3A300001F9F /* CreatePostViewController.swift in Sources */,
|
||||
45B11CCD1B6FC029008D6049 /* UIView_Borders.swift in Sources */,
|
||||
45C24EF91BAD894D00BACB81 /* RGPageViewController.swift in Sources */,
|
||||
45D4B1C91BDCC45900E3FA32 /* ExploreTableCell.swift in Sources */,
|
||||
456F1A1E1B6FD4D0007F9ACF /* MenuTableViewCell.swift in Sources */,
|
||||
456F1A171B6FD3D6007F9ACF /* MenuTableViewController.swift in Sources */,
|
||||
45AD0E2E1B857EA600283FCC /* WebViewController.swift in Sources */,
|
||||
@@ -760,6 +770,8 @@
|
||||
45C24EFB1BAD899D00BACB81 /* DashViewController.swift in Sources */,
|
||||
45681F2E1B7F781E00D1E096 /* Replyable.swift in Sources */,
|
||||
45F6B0B51B95CCA200BDF464 /* BaiscTabBarController.swift in Sources */,
|
||||
45D4B1CB1BDCC55600E3FA32 /* ExploreTableViewController.swift in Sources */,
|
||||
45D4B1CD1BDCC76600E3FA32 /* ExploreSource.swift in Sources */,
|
||||
45C24EFE1BADA48E00BACB81 /* UIColorExtension.swift in Sources */,
|
||||
45D09EB01BDBD375006F91C2 /* LineChart.swift in Sources */,
|
||||
45CF60481B67C3D900CA7F06 /* StorysTableViewController.swift in Sources */,
|
||||
|
||||
@@ -174,9 +174,10 @@
|
||||
</mask>
|
||||
</variation>
|
||||
</imageView>
|
||||
<imageView userInteractionEnabled="NO" contentMode="scaleToFill" horizontalHuggingPriority="251" verticalHuggingPriority="251" image="homei" translatesAutoresizingMaskIntoConstraints="NO" id="bPm-kp-unG">
|
||||
<imageView userInteractionEnabled="NO" contentMode="scaleToFill" horizontalHuggingPriority="251" verticalHuggingPriority="251" translatesAutoresizingMaskIntoConstraints="NO" id="bPm-kp-unG">
|
||||
<rect key="frame" x="270" y="30" width="60" height="60"/>
|
||||
<animations/>
|
||||
<color key="backgroundColor" white="1" alpha="1" colorSpace="calibratedWhite"/>
|
||||
<constraints>
|
||||
<constraint firstAttribute="width" constant="60" id="ddA-Fg-asD"/>
|
||||
<constraint firstAttribute="height" constant="60" id="oom-3y-Dqo"/>
|
||||
@@ -631,6 +632,7 @@
|
||||
<!--首页-->
|
||||
<scene sceneID="5S6-yX-Ikb">
|
||||
<objects>
|
||||
<placeholder placeholderIdentifier="IBFirstResponder" id="wQd-t8-Eyc" userLabel="First Responder" sceneMemberID="firstResponder"/>
|
||||
<tableViewController storyboardIdentifier="StoriesTableViewController" title="首页" id="mC3-dS-U94" customClass="StorysTableViewController" customModule="librx" customModuleProvider="target" sceneMemberID="viewController">
|
||||
<tableView key="view" clipsSubviews="YES" contentMode="scaleToFill" alwaysBounceVertical="YES" dataMode="prototypes" style="plain" separatorStyle="default" rowHeight="200" sectionHeaderHeight="22" sectionFooterHeight="44" id="dQu-RG-SeI">
|
||||
<rect key="frame" x="0.0" y="0.0" width="600" height="600"/>
|
||||
@@ -816,44 +818,14 @@
|
||||
</tableView>
|
||||
<navigationItem key="navigationItem" id="Aav-69-z9d">
|
||||
<nil key="title"/>
|
||||
<barButtonItem key="leftBarButtonItem" image="Menu" id="qUE-TY-ua8">
|
||||
<color key="tintColor" white="1" alpha="1" colorSpace="calibratedWhite"/>
|
||||
<connections>
|
||||
<action selector="presentLeftMenuViewController:" destination="mC3-dS-U94" id="VGL-3r-9KO"/>
|
||||
</connections>
|
||||
</barButtonItem>
|
||||
<view key="titleView" contentMode="scaleToFill" id="FRE-Y5-lqK">
|
||||
<rect key="frame" x="236" y="5.5" width="128" height="33"/>
|
||||
<autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMaxY="YES"/>
|
||||
<subviews>
|
||||
<label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" fixedFrame="YES" text="热门" textAlignment="center" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="YRQ-t0-YOd">
|
||||
<rect key="frame" x="14" y="5" width="100" height="24"/>
|
||||
<animations/>
|
||||
<fontDescription key="fontDescription" name="AvenirNext-Bold" family="Avenir Next" pointSize="17"/>
|
||||
<color key="textColor" red="1" green="1" blue="1" alpha="1" colorSpace="calibratedRGB"/>
|
||||
<nil key="highlightedColor"/>
|
||||
</label>
|
||||
</subviews>
|
||||
<animations/>
|
||||
<color key="backgroundColor" white="0.0" alpha="0.0" colorSpace="calibratedWhite"/>
|
||||
</view>
|
||||
<barButtonItem key="rightBarButtonItem" image="Plus" id="yor-Ss-dyM">
|
||||
<color key="tintColor" white="1" alpha="1" colorSpace="calibratedWhite"/>
|
||||
<connections>
|
||||
<action selector="startSharePost" destination="mC3-dS-U94" id="VXq-sh-S0H"/>
|
||||
</connections>
|
||||
</barButtonItem>
|
||||
</navigationItem>
|
||||
<simulatedTabBarMetrics key="simulatedBottomBarMetrics"/>
|
||||
<connections>
|
||||
<outlet property="shareButton" destination="yor-Ss-dyM" id="0yU-4S-YVT"/>
|
||||
<outlet property="titleLabel" destination="YRQ-t0-YOd" id="UBr-fX-zDe"/>
|
||||
<segue destination="rvR-19-yLR" kind="show" identifier="showUserProfile" id="fgr-G1-uqB"/>
|
||||
</connections>
|
||||
</tableViewController>
|
||||
<placeholder placeholderIdentifier="IBFirstResponder" id="wQd-t8-Eyc" userLabel="First Responder" sceneMemberID="firstResponder"/>
|
||||
</objects>
|
||||
<point key="canvasLocation" x="-6373" y="5202"/>
|
||||
<point key="canvasLocation" x="-6402" y="5051"/>
|
||||
</scene>
|
||||
<!--探索发现-->
|
||||
<scene sceneID="Krh-MH-97G">
|
||||
@@ -909,6 +881,7 @@
|
||||
<connections>
|
||||
<outlet property="iconImage" destination="1Eo-Tk-cnc" id="ksN-IJ-ulC"/>
|
||||
<outlet property="nameLabel" destination="XHI-cA-B9j" id="oui-Gb-4nC"/>
|
||||
<segue destination="A8A-B7-nQX" kind="show" identifier="showExploreSegue" id="wGx-nM-FR1"/>
|
||||
</connections>
|
||||
</collectionViewCell>
|
||||
</cells>
|
||||
@@ -939,6 +912,94 @@
|
||||
</objects>
|
||||
<point key="canvasLocation" x="-6402" y="4190"/>
|
||||
</scene>
|
||||
<!--Explore Table View Controller-->
|
||||
<scene sceneID="tWf-P5-Agy">
|
||||
<objects>
|
||||
<tableViewController id="A8A-B7-nQX" customClass="ExploreTableViewController" customModule="librx" customModuleProvider="target" sceneMemberID="viewController">
|
||||
<tableView key="view" clipsSubviews="YES" contentMode="scaleToFill" alwaysBounceVertical="YES" dataMode="prototypes" style="plain" separatorStyle="default" rowHeight="76" sectionHeaderHeight="28" sectionFooterHeight="28" id="LZn-BX-SYd">
|
||||
<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="Cell" selectionStyle="default" indentationWidth="0.0" reuseIdentifier="Cell" rowHeight="76" id="R8V-Wd-JPl" customClass="ExploreTableCell" customModule="librx" customModuleProvider="target">
|
||||
<rect key="frame" x="0.0" y="92" width="600" height="76"/>
|
||||
<autoresizingMask key="autoresizingMask"/>
|
||||
<tableViewCellContentView key="contentView" opaque="NO" clipsSubviews="YES" multipleTouchEnabled="YES" contentMode="center" tableViewCell="R8V-Wd-JPl" id="HbO-0j-EsW">
|
||||
<rect key="frame" x="0.0" y="0.0" width="600" height="75.5"/>
|
||||
<autoresizingMask key="autoresizingMask"/>
|
||||
<subviews>
|
||||
<imageView userInteractionEnabled="NO" contentMode="scaleToFill" horizontalHuggingPriority="251" verticalHuggingPriority="251" image="default" translatesAutoresizingMaskIntoConstraints="NO" id="R6A-Ti-2a4">
|
||||
<rect key="frame" x="8" y="13" width="50" height="50"/>
|
||||
<constraints>
|
||||
<constraint firstAttribute="height" constant="50" id="5t6-ae-vF1"/>
|
||||
<constraint firstAttribute="width" constant="50" id="96e-ab-UNM"/>
|
||||
</constraints>
|
||||
</imageView>
|
||||
<label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="Label" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="Y7z-Tx-VxF">
|
||||
<rect key="frame" x="71" y="13" width="511" height="16.5"/>
|
||||
<constraints>
|
||||
<constraint firstAttribute="width" constant="250" id="iN7-nL-Gx4"/>
|
||||
</constraints>
|
||||
<fontDescription key="fontDescription" name="HelveticaNeue" family="Helvetica Neue" pointSize="14"/>
|
||||
<color key="textColor" red="0.0" green="0.0" blue="0.0" alpha="1" colorSpace="calibratedRGB"/>
|
||||
<nil key="highlightedColor"/>
|
||||
<variation key="default">
|
||||
<mask key="constraints">
|
||||
<exclude reference="iN7-nL-Gx4"/>
|
||||
</mask>
|
||||
</variation>
|
||||
</label>
|
||||
<label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="Label" textAlignment="natural" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="Xu5-wb-ckw">
|
||||
<rect key="frame" x="71" y="37" width="511" height="12"/>
|
||||
<constraints>
|
||||
<constraint firstAttribute="width" constant="200" id="ik9-js-Hq3"/>
|
||||
</constraints>
|
||||
<fontDescription key="fontDescription" name="HelveticaNeue" family="Helvetica Neue" pointSize="10"/>
|
||||
<color key="textColor" white="0.33333333333333331" alpha="1" colorSpace="calibratedWhite"/>
|
||||
<nil key="highlightedColor"/>
|
||||
<variation key="default">
|
||||
<mask key="constraints">
|
||||
<exclude reference="ik9-js-Hq3"/>
|
||||
</mask>
|
||||
</variation>
|
||||
</label>
|
||||
</subviews>
|
||||
<constraints>
|
||||
<constraint firstItem="R6A-Ti-2a4" firstAttribute="centerY" secondItem="HbO-0j-EsW" secondAttribute="centerY" id="5AU-O1-3NZ"/>
|
||||
<constraint firstItem="R6A-Ti-2a4" firstAttribute="centerY" secondItem="HbO-0j-EsW" secondAttribute="centerY" constant="3.25" id="9Be-MX-Igz"/>
|
||||
<constraint firstAttribute="trailingMargin" secondItem="Y7z-Tx-VxF" secondAttribute="trailing" constant="10" id="9hl-TV-MAD"/>
|
||||
<constraint firstItem="Y7z-Tx-VxF" firstAttribute="leading" secondItem="R6A-Ti-2a4" secondAttribute="trailing" constant="13" id="BZc-oP-DTI"/>
|
||||
<constraint firstAttribute="leadingMargin" secondItem="R6A-Ti-2a4" secondAttribute="leading" id="GwL-pK-1IG"/>
|
||||
<constraint firstItem="Xu5-wb-ckw" firstAttribute="top" secondItem="Y7z-Tx-VxF" secondAttribute="bottom" constant="7.5" id="a6z-Dj-ewo"/>
|
||||
<constraint firstAttribute="trailingMargin" secondItem="Xu5-wb-ckw" secondAttribute="trailing" constant="10" id="c1u-wW-Pq1"/>
|
||||
<constraint firstItem="Xu5-wb-ckw" firstAttribute="leading" secondItem="Y7z-Tx-VxF" secondAttribute="leading" id="hRr-Jr-OA0"/>
|
||||
<constraint firstItem="Y7z-Tx-VxF" firstAttribute="top" secondItem="R6A-Ti-2a4" secondAttribute="top" id="jW5-HE-xPr"/>
|
||||
<constraint firstItem="Xu5-wb-ckw" firstAttribute="bottom" secondItem="R6A-Ti-2a4" secondAttribute="bottom" constant="-4" id="jY6-gT-pP9"/>
|
||||
</constraints>
|
||||
<variation key="default">
|
||||
<mask key="constraints">
|
||||
<exclude reference="9Be-MX-Igz"/>
|
||||
<exclude reference="jY6-gT-pP9"/>
|
||||
</mask>
|
||||
</variation>
|
||||
</tableViewCellContentView>
|
||||
<connections>
|
||||
<outlet property="descriptionLabel" destination="Xu5-wb-ckw" id="MJ2-3m-wE7"/>
|
||||
<outlet property="sourceImg" destination="R6A-Ti-2a4" id="j1Q-Ax-6Bp"/>
|
||||
<outlet property="sourceTitle" destination="Y7z-Tx-VxF" id="gyE-Qe-7Aa"/>
|
||||
</connections>
|
||||
</tableViewCell>
|
||||
</prototypes>
|
||||
<connections>
|
||||
<outlet property="dataSource" destination="A8A-B7-nQX" id="0ev-1E-Ip2"/>
|
||||
<outlet property="delegate" destination="A8A-B7-nQX" id="ICU-A3-r6w"/>
|
||||
</connections>
|
||||
</tableView>
|
||||
</tableViewController>
|
||||
<placeholder placeholderIdentifier="IBFirstResponder" id="sSB-Un-hxK" userLabel="First Responder" sceneMemberID="firstResponder"/>
|
||||
</objects>
|
||||
<point key="canvasLocation" x="-5652" y="4190"/>
|
||||
</scene>
|
||||
<!--首页Navigation-->
|
||||
<scene sceneID="w2o-3B-jX7">
|
||||
<objects>
|
||||
@@ -1456,7 +1517,6 @@
|
||||
<image name="Lightning" width="32" height="32"/>
|
||||
<image name="Like" width="32" height="32"/>
|
||||
<image name="LikeEmpty" width="32" height="32"/>
|
||||
<image name="Menu" width="22" height="22"/>
|
||||
<image name="Plus" width="25" height="25"/>
|
||||
<image name="Python" width="32" height="32"/>
|
||||
<image name="Settings" width="25" height="25"/>
|
||||
@@ -1465,7 +1525,7 @@
|
||||
<image name="Visible" width="32" height="32"/>
|
||||
<image name="action-share" width="19" height="27"/>
|
||||
<image name="background" width="600" height="310"/>
|
||||
<image name="homei" width="480" height="480"/>
|
||||
<image name="default" width="62" height="62"/>
|
||||
<image name="icon-close" width="19" height="20"/>
|
||||
<image name="royaloak" width="640" height="640"/>
|
||||
</resources>
|
||||
|
||||
@@ -15,7 +15,7 @@ class DashViewController: RGPageViewController, RGPageViewControllerDataSource,
|
||||
|
||||
private var loginStateChange: LoginStateHandler?
|
||||
|
||||
var menu: NSArray = ["热门", "最新", "信息流"]
|
||||
var menu: NSArray = ["信息流", "最新", "热门"]
|
||||
var storysViewController1: StorysTableViewController!
|
||||
var storysViewController2: StorysTableViewController!
|
||||
var storysViewController3: StorysTableViewController!
|
||||
@@ -43,12 +43,15 @@ class DashViewController: RGPageViewController, RGPageViewControllerDataSource,
|
||||
|
||||
self.storysViewController1 = storyboard.instantiateViewControllerWithIdentifier("StoriesTableViewController") as! StorysTableViewController
|
||||
self.storysViewController1.postSection = .Default
|
||||
self.storysViewController1.isInlineOfContainer = false
|
||||
|
||||
self.storysViewController2 = storyboard.instantiateViewControllerWithIdentifier("StoriesTableViewController") as! StorysTableViewController
|
||||
self.storysViewController2.postSection = .RecentTimeLine
|
||||
self.storysViewController2.isInlineOfContainer = false
|
||||
|
||||
self.storysViewController3 = storyboard.instantiateViewControllerWithIdentifier("StoriesTableViewController") as! StorysTableViewController
|
||||
self.storysViewController3.postSection = .HotTimeLine
|
||||
self.storysViewController3.isInlineOfContainer = false
|
||||
|
||||
}
|
||||
|
||||
@@ -74,10 +77,10 @@ class DashViewController: RGPageViewController, RGPageViewControllerDataSource,
|
||||
func viewControllerForPageAtIndex(pageViewController: RGPageViewController, index: Int) -> UIViewController? {
|
||||
switch index {
|
||||
|
||||
case 0: return self.storysViewController1
|
||||
case 0: return self.storysViewController3
|
||||
case 1: return self.storysViewController2
|
||||
case 2: return self.storysViewController3
|
||||
default: return storysViewController1
|
||||
case 2: return self.storysViewController1
|
||||
default: return storysViewController3
|
||||
|
||||
}
|
||||
|
||||
|
||||
@@ -12,6 +12,5 @@ class ExploreCell: UICollectionViewCell {
|
||||
|
||||
@IBOutlet weak var nameLabel: UILabel!
|
||||
@IBOutlet weak var iconImage: UIImageView!
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
@@ -47,7 +47,6 @@ class ExploreCollectionViewController: UICollectionViewController, UICollectionV
|
||||
override func viewDidAppear(animated: Bool) {
|
||||
|
||||
super.viewDidAppear(animated)
|
||||
|
||||
LibrxService.loadExplore { (explores) -> () in
|
||||
self.explores = explores
|
||||
self.collectionView?.reloadData()
|
||||
@@ -99,4 +98,22 @@ class ExploreCollectionViewController: UICollectionViewController, UICollectionV
|
||||
dismissViewControllerAnimated(true, completion: nil)
|
||||
}
|
||||
|
||||
override func prepareForSegue(segue: UIStoryboardSegue, sender: AnyObject?) {
|
||||
|
||||
if segue.identifier == "showExploreSegue" {
|
||||
|
||||
if let indexPaths = self.collectionView?.indexPathsForSelectedItems() {
|
||||
|
||||
let selectedExplore = self.explores[indexPaths[0].row]
|
||||
let destinationController = segue.destinationViewController as! ExploreTableViewController
|
||||
destinationController.title = selectedExplore.name
|
||||
destinationController.dataUrl = selectedExplore.resourceUrl
|
||||
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -0,0 +1,33 @@
|
||||
//
|
||||
// ExploreSource.swift
|
||||
// librx
|
||||
//
|
||||
// Created by Yunlong Zheng on 15/10/25.
|
||||
// Copyright © 2015年 librx. All rights reserved.
|
||||
//
|
||||
|
||||
import Foundation
|
||||
|
||||
class ExploreSource{
|
||||
|
||||
|
||||
let id: Int
|
||||
let title: String
|
||||
let img: String
|
||||
let description: String
|
||||
let source_type: String
|
||||
|
||||
init(id: Int,
|
||||
title: String,
|
||||
img: String,
|
||||
description: String,
|
||||
source_type: String){
|
||||
self.id = id
|
||||
self.title = title
|
||||
self.img = img
|
||||
self.description = description
|
||||
self.source_type = source_type
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,19 @@
|
||||
//
|
||||
// ExploreTableCell.swift
|
||||
// librx
|
||||
//
|
||||
// Created by Yunlong Zheng on 15/10/25.
|
||||
// Copyright © 2015年 librx. All rights reserved.
|
||||
//
|
||||
|
||||
import UIKit
|
||||
|
||||
|
||||
class ExploreTableCell: UITableViewCell {
|
||||
|
||||
|
||||
@IBOutlet weak var sourceImg: UIImageView!
|
||||
@IBOutlet weak var sourceTitle: UILabel!
|
||||
@IBOutlet weak var descriptionLabel: UILabel!
|
||||
|
||||
}
|
||||
@@ -0,0 +1,84 @@
|
||||
// ExploreTableViewController.swift
|
||||
//
|
||||
// librx
|
||||
//
|
||||
// Created by Yunlong Zheng on 15/10/25.
|
||||
// Copyright © 2015年 librx. All rights reserved.
|
||||
//
|
||||
|
||||
import UIKit
|
||||
|
||||
class ExploreTableViewController: UITableViewController {
|
||||
|
||||
private var postsLoader = PostsLoader(.Default)
|
||||
private var explores:[ExploreSource] = []
|
||||
|
||||
var dataUrl:String?
|
||||
|
||||
override func viewDidLoad() {
|
||||
super.viewDidLoad()
|
||||
// self.tableView.separatorColor = UIColor(red:240.0/255.0,
|
||||
// green: 240.0/255.0, blue: 240.0/255.0,
|
||||
// alpha: 0.0)
|
||||
}
|
||||
|
||||
override func viewDidAppear(animated: Bool) {
|
||||
super.viewDidAppear(animated)
|
||||
|
||||
|
||||
|
||||
refreshContent()
|
||||
self.tableView.reloadData()
|
||||
}
|
||||
|
||||
func refreshContent() {
|
||||
loadPostsFromUrl(self.dataUrl!)
|
||||
self.tableView.reloadData()
|
||||
}
|
||||
|
||||
func loadPostsFromUrl(dataUrl: String) {
|
||||
|
||||
postsLoader.loadExploreSourcesFromUrl(url: dataUrl) { [weak self](sources) -> () in
|
||||
if let selfView = self {
|
||||
selfView.explores = sources
|
||||
selfView.tableView.reloadData()
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
override func tableView(tableView: UITableView, numberOfRowsInSection section: Int) -> Int {
|
||||
return explores.count
|
||||
}
|
||||
|
||||
override func tableView(tableView: UITableView, cellForRowAtIndexPath indexPath: NSIndexPath) -> UITableViewCell {
|
||||
|
||||
let source = explores[indexPath.row] as ExploreSource
|
||||
let thumbnailUrl = NSURL(string: source.img)
|
||||
|
||||
let cellIdentifier = "Cell"
|
||||
let cell = tableView.dequeueReusableCellWithIdentifier(cellIdentifier, forIndexPath:indexPath) as! ExploreTableCell
|
||||
|
||||
cell.sourceTitle.text = source.title
|
||||
cell.sourceTitle.lineBreakMode = NSLineBreakMode.ByWordWrapping
|
||||
cell.sourceTitle.numberOfLines = 2
|
||||
|
||||
cell.sourceImg.sd_setImageWithURL(thumbnailUrl, placeholderImage: UIImage(named: "default"))
|
||||
|
||||
cell.sourceImg.layer.cornerRadius = cell.sourceImg.frame.size.width / 2
|
||||
cell.sourceImg.clipsToBounds = true
|
||||
cell.sourceImg.layer.borderWidth = 1
|
||||
cell.sourceImg.layer.borderColor = UIColor.blackColor().CGColor
|
||||
|
||||
|
||||
cell.descriptionLabel.text = source.description
|
||||
|
||||
//cell.sourceImg.layer.cornerRadius = cell.sourceTitle.frame.width / 2
|
||||
//cell.sourceImg.clipsToBounds = true
|
||||
|
||||
return cell
|
||||
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
@@ -14,20 +14,19 @@ struct JsonPaser{
|
||||
private static let defaultThumail = "http://7pn5d3.com1.z0.glb.clouddn.com/9050353.png"
|
||||
|
||||
static func parseProfile(json: JSON) -> Profile {
|
||||
|
||||
print(json)
|
||||
|
||||
|
||||
let id: Int = json["id"].int!
|
||||
let avatar: String = json["avatar"].string!
|
||||
let name:String = json["name"].string!
|
||||
let email:String = json["email"].string!
|
||||
let followed:Bool = json["followed"].bool!
|
||||
let startCount: Int = json["stars_count"].int!
|
||||
let likeCount: Int = json["likes_count"].int!
|
||||
let postsCount: Int = json["posts_count"].int!
|
||||
let followsCount: Int = json["follows_count"].int!
|
||||
let followersCount: Int = json["followers_count"].int!
|
||||
|
||||
return Profile(id: id, name: name,email: email, followed: followed, postsCount: postsCount, startCount: startCount, likeCount: likeCount, followsCount: followsCount, followersCount: followersCount)
|
||||
return Profile(id: id, name: name, avatar: avatar, email: email, followed: followed, postsCount: postsCount, likeCount: likeCount, followsCount: followsCount, followersCount: followersCount)
|
||||
|
||||
}
|
||||
|
||||
|
||||
+40
-14
@@ -53,7 +53,6 @@ struct LibrxService {
|
||||
case .SignIn: return "/api/v1/sign_in"
|
||||
case .SignUp: return "/api/v1/sign_up"
|
||||
case .Top: return "/api/v1/timeline"
|
||||
|
||||
case .Posts: return "/api/v1/posts"
|
||||
case .Post(let postId): return "/api/v1/posts/\(postId)"
|
||||
case .Follow(let userId): return "/api/v1/users/\(userId)/follow"
|
||||
@@ -75,7 +74,6 @@ struct LibrxService {
|
||||
case .UserLikedPosts(let userId): return "/api/v1/users/\(userId)/posts/liked"
|
||||
case .UserBookMarkPosts(let userId): return "/api/v1/users/\(userId)/posts/bookmarked"
|
||||
default: return ""
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@@ -120,14 +118,19 @@ struct LibrxService {
|
||||
|
||||
}
|
||||
|
||||
static func postsForUser(userId: Int, response: ([Post]) -> ()) {
|
||||
static func postsForUrl(url: String, response: ([Post]) -> ()) {
|
||||
|
||||
let headers: [String:String] = buildHttpRequestHeader()
|
||||
loadPostsByUrl(url, headers: headers, response: response)
|
||||
|
||||
}
|
||||
|
||||
static func postsForUser(userId: Int, response: ([Post]) -> ()) {
|
||||
|
||||
let urlString = baseURL + ResourcePath.UserPosts(userId: userId).description
|
||||
let headers: [String:String] = buildHttpRequestHeader()
|
||||
loadPostsByUrl(urlString, headers: headers, response: response)
|
||||
|
||||
|
||||
}
|
||||
|
||||
static func postsForUserBookMark(userId: Int, response: ([Post]) -> ()) {
|
||||
@@ -135,7 +138,6 @@ struct LibrxService {
|
||||
let urlString = baseURL + ResourcePath.UserBookMarkPosts(userId: userId).description
|
||||
let headers: [String:String] = buildHttpRequestHeader()
|
||||
|
||||
print(urlString)
|
||||
loadPostsByUrl(urlString, headers: headers, response: response)
|
||||
|
||||
}
|
||||
@@ -168,30 +170,57 @@ struct LibrxService {
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
static func loadPostsByUrl(urlString: String, headers:[String:String], response: ([Post]) ->()) {
|
||||
|
||||
print(urlString)
|
||||
Alamofire.request(.GET, urlString, headers: headers)
|
||||
.response{ (request, res, data, error) in
|
||||
|
||||
|
||||
let json = JSON(data: data!)
|
||||
var posts:[Post] = []
|
||||
|
||||
print(json)
|
||||
|
||||
for index in 0..<json.count {
|
||||
let postData = json[index]
|
||||
let post: Post = JsonPaser.parsePost(postData)
|
||||
posts.append(post)
|
||||
}
|
||||
|
||||
response(posts)
|
||||
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
static func loadExploreSourcesByUrl(urlString: String, response: ([ExploreSource]) -> ()) {
|
||||
|
||||
Alamofire.request(.GET, urlString).response{
|
||||
(request, _, data, error) in
|
||||
|
||||
let json = JSON(data:data!)
|
||||
|
||||
var sources: [ExploreSource] = []
|
||||
|
||||
for index in 0..<json.count {
|
||||
|
||||
let source = json[index]
|
||||
let id = source["id"].intValue
|
||||
let title = source["title"].stringValue
|
||||
let img = source["img"].stringValue
|
||||
let description = source["description"].stringValue
|
||||
let source_type = source["source_type"].stringValue
|
||||
|
||||
let exploreSource:ExploreSource = ExploreSource(id: id, title: title, img: img, description: description, source_type: source_type)
|
||||
|
||||
sources.append(exploreSource)
|
||||
|
||||
}
|
||||
|
||||
response(sources)
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
static func loginWithEmail(email: String, password: String, response: (user:User?) ->()) {
|
||||
|
||||
let urlString = baseURL + ResourcePath.SignIn.description
|
||||
@@ -210,8 +239,6 @@ struct LibrxService {
|
||||
let email = data["user"]["email"].stringValue
|
||||
let id = data["user"]["id"].intValue
|
||||
|
||||
print(id)
|
||||
|
||||
do {
|
||||
|
||||
let payload = try JWT.decode(jwt, algorithm: .HS256(email))
|
||||
@@ -263,7 +290,6 @@ struct LibrxService {
|
||||
doPostRequest(urlString)
|
||||
}
|
||||
|
||||
|
||||
|
||||
static func viewPost(postId: Int){
|
||||
|
||||
|
||||
+25
-1
@@ -11,6 +11,7 @@ import Foundation
|
||||
class PostsLoader {
|
||||
|
||||
typealias PostfixLoadCompetion = (posts:[Post]) ->()
|
||||
typealias ExplorefixLoadCompetion = (sources: [ExploreSource]) ->()
|
||||
|
||||
enum PostSection: CustomStringConvertible {
|
||||
|
||||
@@ -51,7 +52,7 @@ class PostsLoader {
|
||||
private let keyword: String!
|
||||
private let section: PostSection
|
||||
|
||||
init(_ section: PostSection = .Default) {
|
||||
init(_ section: PostSection = .RecentTimeLine) {
|
||||
self.section = section
|
||||
switch (section){
|
||||
case let .Search(keyword):
|
||||
@@ -62,6 +63,20 @@ class PostsLoader {
|
||||
|
||||
}
|
||||
|
||||
func loadExploreSourcesFromUrl(page: Int=1, url: String, completion: ExplorefixLoadCompetion) {
|
||||
|
||||
if isLoading {
|
||||
return
|
||||
}
|
||||
|
||||
isLoading = true
|
||||
|
||||
return exploreSourcesFromUrl(url, completion: completion)
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
func load(page: Int=1, completion: PostfixLoadCompetion){
|
||||
|
||||
if isLoading {
|
||||
@@ -82,6 +97,14 @@ class PostsLoader {
|
||||
|
||||
}
|
||||
|
||||
func exploreSourcesFromUrl(url: String, completion: ExplorefixLoadCompetion){
|
||||
|
||||
LibrxService.loadExploreSourcesByUrl(url) { sources in
|
||||
completion(sources: sources)
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
func postsByUser(userId: Int, completion: PostfixLoadCompetion) {
|
||||
|
||||
LibrxService.postsForUser(userId){ [weak self] posts in
|
||||
@@ -94,6 +117,7 @@ class PostsLoader {
|
||||
|
||||
}
|
||||
|
||||
|
||||
func postsByMe(completion: PostfixLoadCompetion) {
|
||||
|
||||
LibrxService.postsForMyPosts(){ [weak self] posts in
|
||||
|
||||
+3
-3
@@ -12,9 +12,9 @@ class Profile {
|
||||
|
||||
let id: Int
|
||||
let name: String
|
||||
let avatar: String
|
||||
let email: String
|
||||
let followed: Bool
|
||||
let startCount: Int
|
||||
let likeCount: Int
|
||||
let postsCount: Int
|
||||
let followsCount: Int
|
||||
@@ -22,10 +22,10 @@ class Profile {
|
||||
|
||||
init( id: Int,
|
||||
name: String,
|
||||
avatar: String,
|
||||
email: String,
|
||||
followed: Bool,
|
||||
postsCount: Int,
|
||||
startCount: Int,
|
||||
likeCount: Int,
|
||||
followsCount: Int,
|
||||
followersCount: Int
|
||||
@@ -33,11 +33,11 @@ class Profile {
|
||||
|
||||
self.id = id
|
||||
self.name = name
|
||||
self.avatar = avatar
|
||||
self.email = email
|
||||
self.followed = followed
|
||||
self.postsCount = postsCount
|
||||
self.likeCount = likeCount
|
||||
self.startCount = startCount
|
||||
self.followersCount = followersCount
|
||||
self.followsCount = followsCount
|
||||
|
||||
|
||||
@@ -42,6 +42,7 @@ class ProfileViewController: UIViewController{
|
||||
screenWidth = screenSize.width
|
||||
screenHeight = screenSize.height
|
||||
|
||||
|
||||
self.avatarImageView.layer.cornerRadius = self.avatarImageView.frame.width / 2
|
||||
self.avatarImageView.clipsToBounds = true
|
||||
self.avatarImageView.layer.borderWidth = 2
|
||||
@@ -71,6 +72,10 @@ class ProfileViewController: UIViewController{
|
||||
LibrxService.profile(userId) { [weak self](profile) -> () in
|
||||
|
||||
if let selfView = self {
|
||||
|
||||
print(profile.avatar)
|
||||
let avatar = NSURL(string: profile.avatar)
|
||||
selfView.avatarImageView.sd_setImageWithURL(avatar, placeholderImage: UIImage(named: "default"))
|
||||
selfView.nameLabel.text = profile.name
|
||||
selfView.subTitleLabel.text = "简介:\(profile.email)"
|
||||
selfView.followerNumLabel.text = String(profile.followersCount)
|
||||
@@ -87,6 +92,8 @@ class ProfileViewController: UIViewController{
|
||||
LibrxService.me { [weak self](profile) -> () in
|
||||
|
||||
if let selfView = self {
|
||||
let avatar = NSURL(string: profile.avatar)
|
||||
selfView.avatarImageView.sd_setImageWithURL(avatar, placeholderImage: UIImage(named: "default"))
|
||||
selfView.nameLabel.text = profile.name
|
||||
selfView.subTitleLabel.text = "简介:\(profile.email)"
|
||||
selfView.followerNumLabel.text = String(profile.followersCount)
|
||||
@@ -117,7 +124,6 @@ class ProfileViewController: UIViewController{
|
||||
|
||||
|
||||
@IBAction func segmentSwicth(sender: UISegmentedControl) {
|
||||
print(sender.selectedSegmentIndex)
|
||||
self.containerViewController.turnToPage(sender.selectedSegmentIndex)
|
||||
|
||||
}
|
||||
|
||||
@@ -23,7 +23,7 @@ class SettingTableViewController: UITableViewController {
|
||||
}
|
||||
|
||||
override func tableView(tableView: UITableView, didSelectRowAtIndexPath indexPath: NSIndexPath) {
|
||||
print(indexPath.row)
|
||||
|
||||
}
|
||||
|
||||
@IBAction func LogoutButtonPressed(sender: AnyObject) {
|
||||
|
||||
@@ -12,7 +12,6 @@ import SDWebImage
|
||||
class StorysTableViewController: UITableViewController {
|
||||
|
||||
@IBOutlet weak var titleLabel: UILabel!
|
||||
@IBOutlet weak var shareButton: UIBarButtonItem!
|
||||
|
||||
private var timer: NSTimer!
|
||||
private var firstTime = true
|
||||
@@ -28,12 +27,6 @@ class StorysTableViewController: UITableViewController {
|
||||
var postSection : PostsLoader.PostSection = .Default {
|
||||
didSet {
|
||||
postsLoader = PostsLoader(postSection)
|
||||
switch (postSection) {
|
||||
case .Default:
|
||||
self.titleLabel.text = "News"
|
||||
default:
|
||||
self.titleLabel.text = "Others"
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -59,22 +52,6 @@ class StorysTableViewController: UITableViewController {
|
||||
self.tableView.estimatedRowHeight = 100
|
||||
self.tableView.rowHeight = UITableViewAutomaticDimension
|
||||
|
||||
loginStateChange = LoginStateHandler(handler: { [weak self](state) -> () in
|
||||
|
||||
if state == .LoggedIn {
|
||||
self!.shareButton.image = UIImage(named: "Plus")
|
||||
} else {
|
||||
self!.shareButton.image = nil
|
||||
}
|
||||
|
||||
})
|
||||
|
||||
|
||||
if let _ = LocalStore.accessToken() {
|
||||
shareButton.image = UIImage(named: "Plus")
|
||||
} else {
|
||||
shareButton.image = nil
|
||||
}
|
||||
|
||||
// Table View 站位
|
||||
let tableFooterView:UIView = UIView()
|
||||
@@ -177,6 +154,7 @@ class StorysTableViewController: UITableViewController {
|
||||
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
override func scrollViewDidEndDecelerating(scrollView: UIScrollView) {
|
||||
@@ -209,14 +187,13 @@ class StorysTableViewController: UITableViewController {
|
||||
|
||||
func refreshContent() {
|
||||
|
||||
print("refresh Content")
|
||||
print("refresh Content from default api")
|
||||
loadPosts()
|
||||
|
||||
timer = NSTimer.scheduledTimerWithTimeInterval(4.0, target: self, selector: "endOfWork", userInfo: nil, repeats: true)
|
||||
}
|
||||
|
||||
func loadMore(sender:UIButton) {
|
||||
|
||||
print("load more.........")
|
||||
|
||||
}
|
||||
|
||||
@@ -228,6 +205,8 @@ class StorysTableViewController: UITableViewController {
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
func loadPosts() {
|
||||
|
||||
postsLoader.load(completion: { [unowned self] posts in
|
||||
|
||||
@@ -187,7 +187,6 @@ extension WebViewController: UIScrollViewDelegate{
|
||||
extension WebViewController: UIWebViewDelegate{
|
||||
|
||||
func webViewDidFinishLoad(webView: UIWebView) {
|
||||
print("load compeleted")
|
||||
self.activeIndicatorView.hidden = true
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user