-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathPersonDetailViewController.swift
180 lines (143 loc) · 7.37 KB
/
PersonDetailViewController.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
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
//
// PersonDetailViewController.swift
//
//
// Created by Ann McDonough on 12/3/20.
//
import UIKit
class PersonDetailViewController: UIViewController {
var title1 = UILabel()
var detailString = ""
var circlePhoto = UIImageView()
var circlePhotoWidth = CGFloat(150.0)
var spacing = CGFloat(20.0)
var detailStrings: [String] = []
@IBOutlet weak var image1: UIImageView!
var image1Label = UILabel()
var image1Label2 = UILabel()
var image1Label3 = UILabel()
var image2 = UIImageView()
var image2Label = UILabel()
var image3 = UIImageView()
var image3Label = UILabel()
@IBOutlet weak var titleLabel: UILabel!
override func viewDidLoad() {
super.viewDidLoad()
print("before")
image1.contentMode = .scaleAspectFill
image2.contentMode = .scaleAspectFill
image3.contentMode = .scaleAspectFill
setUpTitle()
// setup1Image()
// setup3Image()
setupBirthday()
// Do any additional setup after loading the view.
}
func setUpTitle() {
print("im in here")
//view.addSubview(titleLabel)
view.backgroundColor = .black
titleLabel.frame = CGRect(x: 0, y: view.frame.height/6 , width: self.view.frame.width, height: 25)
titleLabel.text = "Ethnicity"
titleLabel.textAlignment = .center
titleLabel.font = UIFont(name: "DINAlternate-Bold", size: 30)
titleLabel.textColor = .white
//view.addSubview(image)
}
func setup1Image() {
self.image1.frame = CGRect(x: (view.frame.width - CGFloat(circlePhotoWidth))/2, y: titleLabel.frame.maxY + 20 , width: CGFloat(circlePhotoWidth), height: CGFloat(circlePhotoWidth))
image1.clipsToBounds = true
image1.layer.cornerRadius = image1.frame.width/2
image1.image = UIImage(named: "usa")
view.addSubview(image1Label)
image1Label.frame = CGRect(x: image1.frame.minX, y: image1.frame.maxY + 5, width: circlePhotoWidth, height: 44)
image1Label.text = "American"
image1Label.font = UIFont(name: "DINAlternate-Bold", size: 20)
image1Label.textColor = .white
image1Label.textAlignment = .center
}
func setup2Image() {
self.image1.frame = CGRect(x: (view.frame.width/2) - circlePhotoWidth - (spacing/2), y: titleLabel.frame.maxY + 20 , width: CGFloat(circlePhotoWidth), height: CGFloat(circlePhotoWidth))
image1.clipsToBounds = true
image1.layer.cornerRadius = image1.frame.width/2
image1.image = UIImage(named: "usa")
view.addSubview(image1Label)
image1Label.frame = CGRect(x: image1.frame.minX, y: image1.frame.maxY + 5, width: circlePhotoWidth, height: 44)
image1Label.text = "American"
image1Label.font = UIFont(name: "DINAlternate-Bold", size: 20)
image1Label.textColor = .white
image1Label.textAlignment = .center
view.addSubview(image2)
self.image2.frame = CGRect(x: (view.frame.width/2) + (spacing/2), y: titleLabel.frame.maxY + 20 , width: CGFloat(circlePhotoWidth), height: CGFloat(circlePhotoWidth))
image2.clipsToBounds = true
image2.layer.cornerRadius = image1.frame.width/2
image2.image = UIImage(named: "lebanonCircle")
view.addSubview(image2Label)
image2Label.frame = CGRect(x: image2.frame.minX, y: image2.frame.maxY + 5, width: circlePhotoWidth, height: 44)
image2Label.text = "Lebanese"
image2Label.font = UIFont(name: "DINAlternate-Bold", size: 20)
image2Label.textColor = .white
image2Label.textAlignment = .center
}
func setup3Image() {
circlePhotoWidth = CGFloat(120.0)
let totalWidth: CGFloat = (3*circlePhotoWidth) + spacing
self.image1.frame = CGRect(x: (view.frame.width - totalWidth)/2, y: titleLabel.frame.maxY + 20, width: CGFloat(circlePhotoWidth), height: CGFloat(circlePhotoWidth))
image1.clipsToBounds = true
image1.layer.cornerRadius = image1.frame.width/2
image1.image = UIImage(named: "usa")
view.addSubview(image1Label)
image1Label.frame = CGRect(x: image1.frame.minX, y: image1.frame.maxY + 5, width: circlePhotoWidth, height: 44)
image1Label.text = "American"
image1Label.font = UIFont(name: "DINAlternate-Bold", size: 20)
image1Label.textColor = .white
image1Label.textAlignment = .center
view.addSubview(image2)
self.image2.frame = CGRect(x: image1.frame.maxX + (spacing)/2, y: titleLabel.frame.maxY + 20 , width: CGFloat(circlePhotoWidth), height: CGFloat(circlePhotoWidth))
image2.clipsToBounds = true
image2.layer.cornerRadius = image1.frame.width/2
image2.image = UIImage(named: "lebanonCircle")
view.addSubview(image2Label)
image2Label.frame = CGRect(x: image2.frame.minX, y: image2.frame.maxY + 5, width: circlePhotoWidth, height: 44)
image2Label.text = "Lebanese"
image2Label.font = UIFont(name: "DINAlternate-Bold", size: 20)
image2Label.textColor = .white
image2Label.textAlignment = .center
view.addSubview(image3)
self.image3.frame = CGRect(x: image2.frame.maxX + (spacing)/2, y: titleLabel.frame.maxY + 20 , width: CGFloat(circlePhotoWidth), height: CGFloat(circlePhotoWidth))
image3.clipsToBounds = true
image3.layer.cornerRadius = image1.frame.width/2
image3.image = UIImage(named: "lebanonCircle")
view.addSubview(image3Label)
image3Label.frame = CGRect(x: image3.frame.minX, y: image3.frame.maxY + 5, width: circlePhotoWidth, height: 44)
image3Label.text = "Lebanese"
image3Label.font = UIFont(name: "DINAlternate-Bold", size: 20)
image3Label.textColor = .white
image3Label.textAlignment = .center
}
func setupBirthday() {
titleLabel.text = "DOB"
self.image1.frame = CGRect(x: (view.frame.width - CGFloat(circlePhotoWidth))/2, y: titleLabel.frame.maxY + 20 , width: CGFloat(circlePhotoWidth), height: CGFloat(circlePhotoWidth))
image1.clipsToBounds = true
image1.layer.cornerRadius = image1.frame.width/2
image1.image = UIImage(named: "cancer")
view.addSubview(image1Label)
image1Label.frame = CGRect(x: image1.frame.minX, y: image1.frame.maxY + 5, width: circlePhotoWidth, height: 44)
image1Label.text = "19 October 1997"
image1Label.font = UIFont(name: "DINAlternate-Bold", size: 20)
image1Label.textColor = .white
image1Label.textAlignment = .center
view.addSubview(image1Label2)
image1Label2.frame = CGRect(x: image1Label.frame.minX, y: image1Label.frame.maxY + 5, width: circlePhotoWidth, height: 44)
image1Label2.text = "23"
image1Label2.font = UIFont(name: "DINAlternate-Bold", size: 20)
image1Label2.textColor = .white
image1Label2.textAlignment = .center
view.addSubview(image1Label3)
image1Label3.frame = CGRect(x: image1Label2.frame.minX, y: image1Label2.frame.maxY + 5, width: circlePhotoWidth, height: 44)
image1Label3.text = "Libra"
image1Label3.font = UIFont(name: "DINAlternate-Bold", size: 20)
image1Label3.textColor = .white
image1Label3.textAlignment = .center
}
}