Skip to content

Commit

Permalink
为文章列表视图添加了tapGestureRecognizer 修复了服务器数据不匹配导致的bug
Browse files Browse the repository at this point in the history
  • Loading branch information
zpz1237 committed Nov 8, 2015
1 parent e714d95 commit a61e0ea
Show file tree
Hide file tree
Showing 9 changed files with 12 additions and 6 deletions.
Binary file not shown.
Binary file not shown.
Original file line number Diff line number Diff line change
Expand Up @@ -23,13 +23,13 @@
{
"size" : "60x60",
"idiom" : "iphone",
"filename" : "AppIcon 2.png",
"filename" : "IMG_1163.PNG",
"scale" : "2x"
},
{
"size" : "60x60",
"idiom" : "iphone",
"filename" : "AppIcon 3.png",
"filename" : "IMG_1163-1.PNG",
"scale" : "3x"
}
],
Expand Down
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
2 changes: 2 additions & 0 deletions zhihuDaily 2.0/Info.plist
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,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>UIStatusBarStyle</key>
<string>UIStatusBarStyleLightContent</string>
<key>CFBundleDevelopmentRegion</key>
<string>en</string>
<key>CFBundleExecutable</key>
Expand Down
1 change: 1 addition & 0 deletions zhihuDaily 2.0/MainTableViewController.swift
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ class MainTableViewController: UITableViewController, SDCycleScrollViewDelegate,
let leftButton = UIBarButtonItem(image: UIImage(named: "menu"), style: .Plain, target: self.revealViewController(), action: "revealToggle:")
leftButton.tintColor = UIColor.whiteColor()
self.view.addGestureRecognizer(self.revealViewController().panGestureRecognizer())
self.view.addGestureRecognizer(self.revealViewController().tapGestureRecognizer())

//配置无限循环scrollView
cycleScrollView = SDCycleScrollView(frame: CGRectMake(0, 0, self.tableView.frame.width, 154), imageURLStringsGroup: nil)
Expand Down
1 change: 1 addition & 0 deletions zhihuDaily 2.0/ThemeViewController.swift
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,7 @@ class ThemeViewController: UIViewController {

//为当前view添加手势识别
self.view.addGestureRecognizer(self.revealViewController().panGestureRecognizer())
self.view.addGestureRecognizer(self.revealViewController().tapGestureRecognizer())

//生成并配置HeaderImageView
navImageView = UIImageView(frame: CGRectMake(0, 0, self.view.frame.width, 64))
Expand Down
10 changes: 6 additions & 4 deletions zhihuDaily 2.0/WebViewController.swift
Original file line number Diff line number Diff line change
Expand Up @@ -114,6 +114,7 @@ class WebViewController: UIViewController, UIScrollViewDelegate, ParallaxHeaderV

//加载图片
func loadParallaxHeader(imageURL: String, imageSource: String, titleString: String) {

//设置展示的imageView
imageView = UIImageView(frame: CGRectMake(0, 0, self.view.frame.width, 223))
imageView.contentMode = .ScaleAspectFill
Expand Down Expand Up @@ -192,11 +193,13 @@ class WebViewController: UIViewController, UIScrollViewDelegate, ParallaxHeaderV
let css = JSON(dataResult.value!)["css"][0].string!

if let image = JSON(dataResult.value!)["image"].string {
if let imageSource = JSON(dataResult.value!)["image_source"].string {
if let titleString = JSON(dataResult.value!)["title"].string {
if let titleString = JSON(dataResult.value!)["title"].string {
if let imageSource = JSON(dataResult.value!)["image_source"].string {
self.loadParallaxHeader(image, imageSource: imageSource, titleString: titleString)
self.setNeedsStatusBarAppearanceUpdate()
} else {
self.loadParallaxHeader(image, imageSource: "(null)", titleString: titleString)
}
self.setNeedsStatusBarAppearanceUpdate()
}
} else {
self.hasImage = false
Expand Down Expand Up @@ -407,7 +410,6 @@ class WebViewController: UIViewController, UIScrollViewDelegate, ParallaxHeaderV
return .Default
}
if statusBarFlag {
//bug:当切换页面后该函数调用的self是最初的self,其他更改的都是新self,所以这里会有问题
return .LightContent
}
return .Default
Expand Down

0 comments on commit a61e0ea

Please sign in to comment.