Skip to content

Commit

Permalink
update demo
Browse files Browse the repository at this point in the history
  • Loading branch information
xiaozao2008 committed Apr 15, 2019
1 parent 2dfc819 commit b2373de
Show file tree
Hide file tree
Showing 24 changed files with 76 additions and 46 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -3,13 +3,13 @@
{
"size" : "20x20",
"idiom" : "iphone",
"filename" : "Icon-Notification-1.png",
"filename" : "Icon-Notification@2x-1.png",
"scale" : "2x"
},
{
"size" : "20x20",
"idiom" : "iphone",
"filename" : "Icon-Notification@2x-1.png",
"filename" : "Icon-60@1x-1.png",
"scale" : "3x"
},
{
Expand Down Expand Up @@ -103,8 +103,9 @@
"scale" : "2x"
},
{
"idiom" : "ios-marketing",
"size" : "1024x1024",
"idiom" : "ios-marketing",
"filename" : "icon1024.png",
"scale" : "1x"
}
],
Expand Down
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file not shown.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
},
{
"idiom" : "universal",
"filename" : "Photo_Lofter_1@2x.JPG",
"filename" : "Photo_Lofter_1@2x.jpg",
"scale" : "2x"
},
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
},
{
"idiom" : "universal",
"filename" : "Photo_Lofter_2@2x.JPG",
"filename" : "Photo_Lofter_2@2x.jpg",
"scale" : "2x"
},
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
},
{
"idiom" : "universal",
"filename" : "Photo_Lofter_3@2x.JPG",
"filename" : "Photo_Lofter_3@2x.jpg",
"scale" : "2x"
},
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
},
{
"idiom" : "universal",
"filename" : "Photo_Lofter_4@2x.JPG",
"filename" : "Photo_Lofter_4@2x.jpg",
"scale" : "2x"
},
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
},
{
"idiom" : "universal",
"filename" : "Photo_Lofter_5@2x.JPG",
"filename" : "Photo_Lofter_5@2x.jpg",
"scale" : "2x"
},
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
},
{
"idiom" : "universal",
"filename" : "Photo_Lofter_6@2x.JPG",
"filename" : "Photo_Lofter_6@2x.jpg",
"scale" : "2x"
},
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
},
{
"idiom" : "universal",
"filename" : "Photo_Lofter_7@2x.JPG",
"filename" : "Photo_Lofter_7@2x.jpg",
"scale" : "2x"
},
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
},
{
"idiom" : "universal",
"filename" : "Photo_Lofter_8@2x.JPG",
"filename" : "Photo_Lofter_8@2x.jpg",
"scale" : "2x"
},
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
},
{
"idiom" : "universal",
"filename" : "Photo_Lofter_9@2x.JPG",
"filename" : "Photo_Lofter_9@2x.jpg",
"scale" : "2x"
},
{
Expand Down

Large diffs are not rendered by default.

52 changes: 27 additions & 25 deletions ESPullToRefreshExample/ESPullToRefreshExample/ViewController.swift
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,13 @@

import UIKit

public enum ESRefreshExampleType {
case defaulttype, meituan, wechat
public enum ESRefreshExampleType: String {
case defaulttype = "Default"
case meituan = "美团网 (Meituan.com)"
case wechat = "WeChat"
case textView = "TextView"
case day = "Day"
case collectionView = "CollectionView"
}

public enum ESRefreshExampleListType {
Expand All @@ -21,21 +26,20 @@ public class ViewController: UIViewController, UITableViewDataSource, UITableVie

public var listType: ESRefreshExampleListType = .tableview

public let dataArray = [
"Default",
"美团网 (Meituan.com)",
"WeChat",
"TextView",
"Day",
"CollectionView"
]
public let dataArray: [ESRefreshExampleType] = [
.defaulttype,
.meituan,
.wechat,
.textView,
.day,
.collectionView]

public override func viewDidLoad() {
super.viewDidLoad()
let appearance = UIBarButtonItem.appearance()
appearance.setBackButtonTitlePositionAdjustment(UIOffset.init(horizontal: 0.0, vertical: -60), for: .default)

self.navigationController?.navigationBar.isTranslucent = true
self.navigationController?.navigationBar.isTranslucent = false
self.navigationController?.navigationBar.barTintColor = UIColor.init(red: 250/255.0, green: 250/255.0, blue: 250/255.0, alpha: 0.8)
self.navigationController?.navigationBar.titleTextAttributes = [NSAttributedString.Key.foregroundColor : UIColor.init(red: 38/255.0, green: 38/255.0, blue: 38/255.0, alpha: 1.0), NSAttributedString.Key.font: UIFont.systemFont(ofSize: 16.0)]
self.navigationController?.navigationBar.tintColor = UIColor.init(red: 38/255.0, green: 38/255.0, blue: 38/255.0, alpha: 1.0)
Expand All @@ -44,34 +48,32 @@ public class ViewController: UIViewController, UITableViewDataSource, UITableVie
self.tableView.register(UINib.init(nibName: "ListTableViewCell", bundle: nil), forCellReuseIdentifier: "ListTableViewCell")
}

public func select(indexPath: IndexPath) {
public func selectRow(_ element: ESRefreshExampleType) {
var vc: UIViewController!
switch indexPath.row {
case 0:
switch element {
case .defaulttype:
vc = ESRefreshTableViewController.init(style: .plain)
if let vc = vc as? ESRefreshTableViewController {
vc.type = .defaulttype
}
case 1:
case .meituan:
vc = ESRefreshTableViewController.init(style: .plain)
if let vc = vc as? ESRefreshTableViewController {
vc.type = .meituan
}
case 2:
case .wechat:
vc = ESRefreshTableViewController.init(style: .plain)
if let vc = vc as? ESRefreshTableViewController {
vc.type = .wechat
}
case 3:
case .textView:
vc = TextViewController.init()
case 4:
case .day:
vc = ESRefreshTableViewController.init(style: .plain)
case 5:
case .collectionView:
vc = CollectionViewController()
default:
break
}
vc.title = dataArray[indexPath.row]
vc.title = element.rawValue
self.navigationController?.pushViewController(vc, animated: true)
}

Expand All @@ -87,7 +89,7 @@ public class ViewController: UIViewController, UITableViewDataSource, UITableVie
public func tableView(_ tableView: UITableView, cellForRowAt indexPath: IndexPath) -> UITableViewCell {
let cell = self.tableView.dequeueReusableCell(withIdentifier: "ListTableViewCell")
if let cell = cell as? ListTableViewCell {
cell.titleLabel.text = "\(indexPath.row + 1). " + dataArray[indexPath.row]
cell.titleLabel.text = "\(indexPath.row + 1). " + dataArray[indexPath.row].rawValue
}
return cell!
}
Expand All @@ -104,7 +106,7 @@ public class ViewController: UIViewController, UITableViewDataSource, UITableVie

public func tableView(_ tableView: UITableView, didSelectRowAt indexPath: IndexPath) {
tableView.deselectRow(at: indexPath as IndexPath, animated: true)
self.select(indexPath: indexPath)
self.selectRow(dataArray[indexPath.row])
}

}

0 comments on commit b2373de

Please sign in to comment.