@@ -57,12 +57,13 @@ internal class SurveyViewController: UIViewController, WKNavigationDelegate, WKS
57
57
// Setup views
58
58
self . setupWebView ( )
59
59
self . setupCloseButton ( )
60
- self . changeFrame ( rect: self . view. bounds)
61
60
62
61
// Add views and layout
63
62
self . view. backgroundColor = UIColor . black. withAlphaComponent ( 0.6 )
64
63
self . view. addSubview ( self . webView)
65
64
self . view. addSubview ( self . closeButton)
65
+
66
+ self . changeFrame ( rect: self . view. bounds)
66
67
}
67
68
68
69
// MARK: - Setup
@@ -86,7 +87,7 @@ internal class SurveyViewController: UIViewController, WKNavigationDelegate, WKS
86
87
87
88
/// Create and setup `closeButton`
88
89
private func setupCloseButton( ) {
89
- self . closeButton = UIButton ( frame: CGRect ( x: 0 , y: 0 , width: 30 , height: 30 ) )
90
+ self . closeButton = UIButton ( frame: CGRect ( x: 0 , y: 0 , width: 35 , height: 35 ) )
90
91
self . closeButton. setTitle ( " X " , for: . normal)
91
92
self . closeButton. backgroundColor = UIColor . white
92
93
self . closeButton. setTitleColor ( UIColor . black, for: . normal)
@@ -102,15 +103,17 @@ internal class SurveyViewController: UIViewController, WKNavigationDelegate, WKS
102
103
* - parameter rect: New rect for recalculation
103
104
*/
104
105
private func changeFrame( rect: CGRect ) {
105
- switch self . displayMode {
106
-
106
+
107
+ switch displayMode {
107
108
case . alert:
108
- self . webView. frame = rect. insetBy ( dx: 20 , dy: 30 ) . offsetBy ( dx: 0 , dy: 10 )
109
- self . closeButton. center = CGPoint ( x: self . webView. frame. maxX, y: self . webView. frame. minY)
109
+ webView. frame = rect. insetBy ( dx: 20 , dy: 30 ) . offsetBy ( dx: 0 , dy: 10 )
110
+ closeButton. center = CGPoint ( x: webView. frame. maxX - 30 ,
111
+ y: webView. frame. minY + 35 )
110
112
111
113
case . fullscreen:
112
- self . webView. frame = rect
113
- self . closeButton. center = CGPoint ( x: self . webView. frame. maxX - 30 , y: self . webView. frame. minY + 40 )
114
+ webView. frame = rect
115
+ closeButton. center = CGPoint ( x: webView. frame. maxX - 30 ,
116
+ y: webView. frame. minY + Device( ) . topInset + 35 )
114
117
115
118
default :
116
119
break
0 commit comments