-
Notifications
You must be signed in to change notification settings - Fork 0
/
SelectSinglePageView.swift
125 lines (104 loc) · 4.17 KB
/
SelectSinglePageView.swift
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
//
// SelectSinglePageView.swift
// roop
//
// Created by 이천지 on 2016. 11. 10..
// Copyright © 2016년 project. All rights reserved.
//
import UIKit
import Alamofire
import AlamofireImage
class SelectSinglePageView: UIViewController {
var passDataInfo = CardViewData()
var photoImage = UIImage()
var profileImage = UIImage()
@IBOutlet weak var navigationBar: UINavigationBar!
@IBOutlet weak var singlePhoto: UIImageView!
@IBOutlet weak var singleProfile: UIImageView!
@IBOutlet weak var singleUserName: UILabel!
@IBOutlet weak var singleEmail: UILabel!
@IBOutlet weak var ansBrandName: UILabel!
@IBOutlet weak var ansPrice: UILabel!
@IBOutlet weak var ansDescription: UILabel!
@IBOutlet weak var ansSize: UILabel!
@IBOutlet weak var ansColor: UILabel!
@IBOutlet weak var ansGender: UILabel!
@IBOutlet weak var singPhotoConstraints: NSLayoutConstraint!
var interactor:Interactor? = nil
override func viewDidLoad() {
let pixelHeight = (self.passDataInfo.pixel?["h"] as! NSString).integerValue
let pixelWidth = (self.passDataInfo.pixel?["w"] as! NSString).integerValue
print("===================")
print(pixelHeight)
print(pixelWidth)
let radius = singleProfile.frame.size.height / 2
singleProfile.layer.cornerRadius = radius
singleProfile.layer.masksToBounds = true
let screenSize: CGRect = UIScreen.main.bounds
let widthRatio = UIScreen.main.bounds.width / CGFloat(pixelWidth)
singPhotoConstraints.constant = CGFloat(CGFloat(pixelHeight) * widthRatio)
print(screenSize)
Alamofire.request("http://www.roop.xyz\(passDataInfo.cardPhotoAddress!)").responseImage { response in
debugPrint(response)
if let image = response.result.value {
self.singlePhoto.image = image
}
}
Alamofire.request("https:\(passDataInfo.profilePhotoAddress!)").responseImage { response in
debugPrint(response)
if let image = response.result.value {
self.singleProfile.image = image
}
}
// self.singleProfile.image = profileImage
singleUserName.text = passDataInfo.userName
singleEmail.text = passDataInfo.email!
if(passDataInfo.ansDescription != nil){
ansDescription.text = passDataInfo.ansDescription
}
if(passDataInfo.ansColor != nil){
ansColor.text = passDataInfo.ansColor
}
if(passDataInfo.ansPrice != nil){
ansPrice.text = "\(passDataInfo.ansPrice!)"
}
if(passDataInfo.ansSize != nil){
ansSize.text = passDataInfo.ansSize
}
if(passDataInfo.ansSex != nil){
ansGender.text = passDataInfo.ansSex
}
if(passDataInfo.ansBrandname != nil){
ansBrandName.text = passDataInfo.ansBrandname
}
// self.SetBackBarButtonCustom()
instantiatePanGestureRecognizer(self, #selector(gesture))
}
//
// func SetBackBarButtonCustom()
// {
// //Initialising "back button"
// let btnLeftMenu: UIButton = UIButton()
// btnLeftMenu.setImage(UIImage(named: "backButton"), for: UIControlState())
// btnLeftMenu.addTarget(self, action: #selector(self.onClickBack), for: UIControlEvents.touchUpInside)
// btnLeftMenu.frame = CGRect(x: 0, y: 0, width: 33/2, height: 50/2)
// let barButton = UIBarButtonItem(customView: btnLeftMenu)
// self.navigationItem.leftBarButtonItem = barButton
// }
//
// func onClickBack()
// {
// self.navigationController?.popViewController(animated: true)
// }
//
override func viewWillAppear(_ animated: Bool) {
navigationController?.isNavigationBarHidden = false
self.tabBarController?.tabBar.isHidden = true
}
@IBAction func dismiss(_ sender: Any) {
dismissVCLeftToRight(self)
}
func gesture(_ sender: UIScreenEdgePanGestureRecognizer) {
dismissVCOnPanGesture(self, sender, interactor!)
}
}