Skip to content

Commit

Permalink
UI框架几乎全部完成 准备导入数据
Browse files Browse the repository at this point in the history
  • Loading branch information
zpz1237 committed Oct 21, 2015
1 parent 2e6b6d5 commit a195cb7
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 22 deletions.
21 changes: 4 additions & 17 deletions zhihuDaily 2.0/ThemeViewController.swift
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@ class ThemeViewController: UIViewController {

@IBOutlet weak var tableView: UITableView!

var animator: ZFModalTransitionAnimator!
var selectedNewsId = ""

override func viewDidLoad() {
Expand Down Expand Up @@ -53,8 +52,9 @@ class ThemeViewController: UIViewController {
}

override func viewWillAppear(animated: Bool) {
// let rect = CGRectMake(0, 20, UIScreen.mainScreen().bounds.width, UIScreen.mainScreen().bounds.height)
// self.tableView.frame = rect

let rect = CGRectMake(0, 0, UIScreen.mainScreen().bounds.width, UIScreen.mainScreen().bounds.height)
self.tableView.frame = rect
}

//设置StatusBar颜色
Expand Down Expand Up @@ -140,22 +140,9 @@ extension ThemeViewController: UITableViewDelegate, UITableViewDataSource, Paral
//拿到webViewController
let webViewController = self.storyboard?.instantiateViewControllerWithIdentifier("webViewController") as!WebViewController

//对animator进行初始化
animator = ZFModalTransitionAnimator(modalViewController: webViewController)
self.animator.dragable = true
self.animator.bounces = false
self.animator.behindViewAlpha = 0.7
self.animator.behindViewScale = 0.7
self.animator.transitionDuration = 0.7
self.animator.direction = ZFModalTransitonDirection.Right

//设置webViewController
webViewController.transitioningDelegate = self.animator
webViewController.newsId = "Jst Try"

//实施转场
self.presentViewController(webViewController, animated: true) { () -> Void in

}
self.navigationController?.pushViewController(webViewController, animated: true)
}
}
12 changes: 7 additions & 5 deletions zhihuDaily 2.0/WebViewController.swift
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ import UIKit
import Alamofire
import SwiftyJSON

class WebViewController: UIViewController, UIScrollViewDelegate, ParallaxHeaderViewDelegate {
class WebViewController: UIViewController, UIScrollViewDelegate, ParallaxHeaderViewDelegate, UIGestureRecognizerDelegate {

@IBOutlet weak var webView: UIWebView!
@IBOutlet weak var statusBarBackground: UIView!
Expand Down Expand Up @@ -56,9 +56,10 @@ class WebViewController: UIViewController, UIScrollViewDelegate, ParallaxHeaderV
//避免webScrollView的ContentView过长 挡住底层View
self.view.clipsToBounds = true

if hasImage == false {
statusBarBackground.backgroundColor = UIColor.whiteColor()
}
//隐藏默认返回button但保留左划返回
self.navigationItem.hidesBackButton = true
self.navigationController?.interactivePopGestureRecognizer?.enabled = true
self.navigationController?.interactivePopGestureRecognizer?.delegate = self

//对scrollView做基本配置
self.webView.scrollView.delegate = self
Expand All @@ -68,12 +69,13 @@ class WebViewController: UIViewController, UIScrollViewDelegate, ParallaxHeaderV
}

override func viewWillAppear(animated: Bool) {
loadWebView("")
if hasImage {
loadParallaxHeader("")
} else {
statusBarBackground.backgroundColor = UIColor.whiteColor()
loadNormalHeader()
}
loadWebView("")
}

//加载普通header
Expand Down

0 comments on commit a195cb7

Please sign in to comment.