@@ -10,20 +10,45 @@ import UIKit
10
10
11
11
class CalibrateView : UIVisualEffectView {
12
12
13
- let instructionLabel : UILabel = {
14
- let label = UILabel ( )
15
- label. textAlignment = . center
16
- label. text = " Calibrate compass before use for better accuracy "
17
- label. numberOfLines = 2
18
- return label
19
- } ( )
13
+ var stack = UIStackView ( )
14
+ var vibrancyView = UIVisualEffectView ( )
15
+ var instructionLabel = UILabel ( )
16
+ var calibrateImageView = UIImageView ( )
17
+ var removeButton = UIImageView ( )
20
18
21
19
private func setupViews( ) {
22
20
effect = blurEffect
23
21
translatesAutoresizingMaskIntoConstraints = false
24
22
25
- contentView. addSubview ( instructionLabel)
26
- instructionLabel. fillSuperview ( padding: UIEdgeInsets ( top: 20 , left: 20 , bottom: 20 , right: 20 ) )
23
+ vibrancyView. effect = UIVibrancyEffect ( blurEffect: blurEffect, style: . secondaryLabel)
24
+ contentView. addSubview ( vibrancyView)
25
+ vibrancyView. fillSuperview ( )
26
+
27
+ instructionLabel. textAlignment = . center
28
+ instructionLabel. numberOfLines = 2
29
+ instructionLabel. font = . systemFont( ofSize: 16 , weight: . semibold)
30
+ instructionLabel. text = " Calibrate compass before use for better accuracy "
31
+
32
+ calibrateImageView. contentMode = . scaleAspectFit
33
+ calibrateImageView. image = #imageLiteral( resourceName: " calibrate " ) . withRenderingMode ( . alwaysTemplate)
34
+ calibrateImageView. widthAnchor. constraint ( equalToConstant: 164 ) . isActive = true
35
+ calibrateImageView. heightAnchor. constraint ( equalToConstant: 78 ) . isActive = true
36
+
37
+ stack. axis = . vertical
38
+ stack. distribution = . fill
39
+ stack. alignment = . center
40
+ stack. spacing = 30
41
+ stack. addArrangedSubview ( calibrateImageView)
42
+ stack. addArrangedSubview ( instructionLabel)
43
+
44
+ vibrancyView. contentView. addSubview ( stack)
45
+ stack. fillSuperview ( padding: UIEdgeInsets ( top: 40 , left: 30 , bottom: 30 , right: 30 ) )
46
+
47
+ removeButton. translatesAutoresizingMaskIntoConstraints = false
48
+ removeButton. image = UIImage ( systemName: " xmark.circle.fill " , withConfiguration: UIImage . SymbolConfiguration ( pointSize: 28 ) )
49
+ vibrancyView. contentView. addSubview ( removeButton)
50
+ removeButton. topAnchor. constraint ( equalTo: contentView. topAnchor, constant: 10 ) . isActive = true
51
+ removeButton. trailingAnchor. constraint ( equalTo: contentView. trailingAnchor, constant: - 10 ) . isActive = true
27
52
}
28
53
29
54
override func layoutSubviews( ) {
0 commit comments