回答編集履歴
1
修正
test
CHANGED
@@ -1,25 +1,139 @@
|
|
1
|
-
|
1
|
+
おそらくViewの生成(サブクラスなのか?)、画面遷移部分のコードを見ないとなんとも言えないと思います。
|
2
|
+
|
3
|
+
※ gifを見てもおそらく`Navigation`の`Push遷移`では無い気がしました。
|
2
4
|
|
3
5
|
|
4
6
|
|
5
|
-
|
7
|
+
違うとおもいますが、ベースのViewにheaderViewを乗せ画面遷移させるコードを書いてみました。
|
8
|
+
|
9
|
+
普通のpushの遷移でしたら角丸が消えることは無いです。
|
6
10
|
|
7
11
|
|
8
12
|
|
9
13
|
```swift
|
10
14
|
|
15
|
+
|
16
|
+
|
11
|
-
|
17
|
+
import UIKit
|
12
18
|
|
13
19
|
|
14
20
|
|
15
|
-
let gradationColors = [UIColor.myGradationStartColor().CGColor, UIColor.myGradationEndColor().CGColor]
|
16
|
-
|
17
|
-
|
21
|
+
class ViewController: UIViewController {
|
18
|
-
|
19
|
-
headerView.layer.insertSublayer(headerGradationLayer, atIndex: 0)
|
20
22
|
|
21
23
|
|
22
24
|
|
25
|
+
override func viewDidLoad() {
|
26
|
+
|
27
|
+
|
28
|
+
|
29
|
+
super.viewDidLoad()
|
30
|
+
|
31
|
+
let screenWidth = UIScreen.mainScreen().bounds.width
|
32
|
+
|
33
|
+
let baseView = UIView(frame: CGRect(x: 0, y: 20, width: screenWidth, height: 100))
|
34
|
+
|
35
|
+
baseView.backgroundColor = UIColor.yellowColor()
|
36
|
+
|
37
|
+
view.addSubview(baseView)
|
38
|
+
|
39
|
+
|
40
|
+
|
41
|
+
let headerView = UIView(frame: CGRect(x: 10, y: 10, width: screenWidth - 20, height: 80))
|
42
|
+
|
43
|
+
headerView.backgroundColor = UIColor.blueColor()
|
44
|
+
|
45
|
+
headerView.layer.cornerRadius = 10
|
46
|
+
|
47
|
+
headerView.layer.masksToBounds = true
|
48
|
+
|
49
|
+
baseView.addSubview(headerView)
|
50
|
+
|
51
|
+
|
52
|
+
|
53
|
+
let button = UIButton(frame: CGRect(x: 10, y: 20, width: 100, height: 50))
|
54
|
+
|
55
|
+
button.setTitle("Next", forState: .Normal)
|
56
|
+
|
57
|
+
button.addTarget(self, action: #selector(self.pusuButton(_:)), forControlEvents: .TouchUpInside)
|
58
|
+
|
59
|
+
baseView.addSubview(button)
|
60
|
+
|
61
|
+
|
62
|
+
|
23
|
-
}
|
63
|
+
}
|
64
|
+
|
65
|
+
|
66
|
+
|
67
|
+
func pusuButton(sender: UIButton) {
|
68
|
+
|
69
|
+
let next = ViewController1()
|
70
|
+
|
71
|
+
self.navigationController?.pushViewController(next, animated: true)
|
72
|
+
|
73
|
+
}
|
74
|
+
|
75
|
+
}
|
76
|
+
|
77
|
+
|
78
|
+
|
79
|
+
|
80
|
+
|
81
|
+
class ViewController1: UIViewController {
|
82
|
+
|
83
|
+
|
84
|
+
|
85
|
+
override func viewDidLoad() {
|
86
|
+
|
87
|
+
super.viewDidLoad()
|
88
|
+
|
89
|
+
|
90
|
+
|
91
|
+
view.backgroundColor = UIColor.whiteColor()
|
92
|
+
|
93
|
+
|
94
|
+
|
95
|
+
let screenWidth = UIScreen.mainScreen().bounds.width
|
96
|
+
|
97
|
+
let baseView = UIView(frame: CGRect(x: 0, y: 20, width: screenWidth, height: 100))
|
98
|
+
|
99
|
+
baseView.backgroundColor = UIColor.yellowColor()
|
100
|
+
|
101
|
+
view.addSubview(baseView)
|
102
|
+
|
103
|
+
|
104
|
+
|
105
|
+
let headerView = UIView(frame: CGRect(x: 10, y: 10, width: screenWidth - 20, height: 80))
|
106
|
+
|
107
|
+
headerView.backgroundColor = UIColor.blueColor()
|
108
|
+
|
109
|
+
headerView.layer.cornerRadius = 10
|
110
|
+
|
111
|
+
headerView.layer.masksToBounds = true
|
112
|
+
|
113
|
+
baseView.addSubview(headerView)
|
114
|
+
|
115
|
+
|
116
|
+
|
117
|
+
let button = UIButton(frame: CGRect(x: 10, y: 20, width: 100, height: 50))
|
118
|
+
|
119
|
+
button.setTitle("Back", forState: .Normal)
|
120
|
+
|
121
|
+
button.addTarget(self, action: #selector(self.pusuButton(_:)), forControlEvents: .TouchUpInside)
|
122
|
+
|
123
|
+
baseView.addSubview(button)
|
124
|
+
|
125
|
+
|
126
|
+
|
127
|
+
}
|
128
|
+
|
129
|
+
|
130
|
+
|
131
|
+
func pusuButton(sender: UIButton) {
|
132
|
+
|
133
|
+
self.navigationController?.popViewControllerAnimated(true)
|
134
|
+
|
135
|
+
}
|
136
|
+
|
137
|
+
}
|
24
138
|
|
25
139
|
```
|