-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
11 changed files
with
390 additions
and
12 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Binary file modified
BIN
+13.7 KB
(120%)
DanTangSwift.xcworkspace/xcuserdata/ZTX.xcuserdatad/UserInterfaceState.xcuserstate
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,102 @@ | ||
// | ||
// ProductDetailVC.swift | ||
// DanTangSwift | ||
// | ||
// Created by 赵天旭 on 2017/7/12. | ||
// Copyright © 2017年 ZTX. All rights reserved. | ||
// | ||
|
||
import UIKit | ||
|
||
class ProductDetailVC: TXBaseViewController,UITableViewDelegate,UITableViewDataSource { | ||
var tableView : UITableView? | ||
var scrollView = UIScrollView() | ||
|
||
override func viewDidLoad() { | ||
super.viewDidLoad() | ||
|
||
self.initTableView() | ||
self.initHeaderView() | ||
// Do any additional setup after loading the view. | ||
} | ||
|
||
private func initTableView() { | ||
tableView = UITableView(frame: CGRect(x: 0, y: 64, width: KScreenWidth, height: KScreenHeight), style: .plain) | ||
tableView?.backgroundColor = TXGlobalColor() | ||
tableView?.delegate = self | ||
tableView?.dataSource = self | ||
tableView?.autoresizingMask = [.flexibleHeight,.flexibleWidth] | ||
self.view.addSubview(tableView!) | ||
} | ||
|
||
private func initHeaderView() { | ||
let headerView = UIView(frame: CGRect(x: 0, y: 0, width: KScreenWidth, height: 520)) | ||
headerView.backgroundColor = UIColor.white | ||
|
||
scrollView = UIScrollView(frame: CGRect(x: 0, y: 0, width: KScreenWidth, height: 375)) | ||
scrollView.delegate = self | ||
scrollView.backgroundColor = UIColor.red | ||
headerView.addSubview(scrollView) | ||
|
||
headerView.addSubview(self.titleLabel) | ||
headerView.addSubview(self.priceLabel) | ||
headerView.addSubview(self.descriptionLabel) | ||
|
||
titleLabel.snp.makeConstraints { (make) in | ||
make.top.equalTo(scrollView.snp.bottom) | ||
|
||
} | ||
|
||
tableView?.tableHeaderView = headerView | ||
} | ||
|
||
func tableView(_ tableView: UITableView, numberOfRowsInSection section: Int) -> Int { | ||
return 0 | ||
} | ||
func tableView(_ tableView: UITableView, cellForRowAt indexPath: IndexPath) -> UITableViewCell { | ||
let cell = UITableViewCell() | ||
return cell | ||
} | ||
|
||
//MARK:--- 懒加载 | ||
//标题 | ||
private lazy var titleLabel : UILabel = { | ||
let titleLabel = UILabel() | ||
titleLabel.numberOfLines = 0 | ||
titleLabel.textColor = UIColor.black | ||
return titleLabel | ||
}() | ||
//价格 | ||
private lazy var priceLabel : UILabel = { | ||
let priceLabel = UILabel() | ||
priceLabel.textColor = TXGlobalRedColor() | ||
priceLabel.numberOfLines = 0 | ||
priceLabel.font = UIFont.systemFont(ofSize: 16) | ||
return priceLabel | ||
}() | ||
//描述 | ||
private lazy var descriptionLabel : UILabel = { | ||
let descriptionLabel = UILabel() | ||
descriptionLabel.numberOfLines = 0 | ||
descriptionLabel.textColor = TXColor(r: 0, g: 0, b: 0, a: 0.6) | ||
descriptionLabel.font = UIFont.systemFont(ofSize: 15) | ||
return descriptionLabel | ||
}() | ||
|
||
override func didReceiveMemoryWarning() { | ||
super.didReceiveMemoryWarning() | ||
// Dispose of any resources that can be recreated. | ||
} | ||
|
||
|
||
/* | ||
// MARK: - Navigation | ||
|
||
// In a storyboard-based application, you will often want to do a little preparation before navigation | ||
override func prepare(for segue: UIStoryboardSegue, sender: Any?) { | ||
// Get the new view controller using segue.destinationViewController. | ||
// Pass the selected object to the new view controller. | ||
} | ||
*/ | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,49 @@ | ||
// | ||
// TXProductModel.swift | ||
// DanTangSwift | ||
// | ||
// Created by 赵天旭 on 2017/7/11. | ||
// Copyright © 2017年 ZTX. All rights reserved. | ||
// | ||
|
||
import UIKit | ||
|
||
class TXProductModel: NSObject { | ||
var cover_image_url: String? | ||
var created_at: Int? | ||
var describe: String? | ||
var editor_id: Int? | ||
var favorites_count: Int? | ||
var id: Int? | ||
var image_urls: [String]? | ||
var is_favorite: Bool? | ||
var name: String? | ||
var price: String? | ||
var purchase_id: Int? | ||
var purchase_status: Int? | ||
var purchase_type: Int? | ||
var purchase_url: String? | ||
var updated_at: Int? | ||
var url: String? | ||
|
||
init(dict: [String: AnyObject]) { | ||
super.init() | ||
cover_image_url = dict["cover_image_url"] as? String | ||
created_at = dict["created_at"] as? Int | ||
describe = dict["description"] as? String | ||
editor_id = dict["editor_id"] as? Int | ||
favorites_count = dict["favorites_count"] as? Int | ||
id = dict["id"] as? Int | ||
image_urls = dict["image_urls"] as? [String] | ||
is_favorite = dict["is_favorite"] as? Bool | ||
name = dict["name"] as? String | ||
price = dict["price"] as? String | ||
purchase_id = dict["purchase_id"] as? Int | ||
purchase_status = dict["purchase_status"] as? Int | ||
purchase_type = dict["purchase_type"] as? Int | ||
purchase_url = dict["purchase_url"] as? String | ||
updated_at = dict["updated_at"] as? Int | ||
url = dict["url"] as? String | ||
} | ||
|
||
} |
Oops, something went wrong.