@@ -16,8 +16,7 @@ class LoginViewController: UIViewController, UITextFieldDelegate {
16
16
var username = UITextField ( )
17
17
var password = UITextField ( )
18
18
var login = UIButton ( )
19
- var register = UIButton ( )
20
-
19
+
21
20
var backgroundBlurView = UIView ( )
22
21
var loadingView = UIActivityIndicatorView ( )
23
22
@@ -68,14 +67,7 @@ class LoginViewController: UIViewController, UITextFieldDelegate {
68
67
login. addTarget ( self , action: " login: " , forControlEvents: UIControlEvents . TouchUpInside)
69
68
login. tintColor = StaticVar . greenBackgroundColor
70
69
login. backgroundColor = StaticVar . greenBackgroundColor
71
-
72
- register. frame = CGRectMake ( 25 , self . login. frame. maxY + 20 , self . view. frame. width - 50 , 50 )
73
- register. setTitle ( " REGISTER " , forState: UIControlState . Normal)
74
- register. titleLabel? . font = UIFont ( name: " Roboto-Medium " , size: 20 ) !
75
- register. addTarget ( self , action: " register: " , forControlEvents: UIControlEvents . TouchUpInside)
76
- register. tintColor = UIColor . lightGrayColor ( )
77
- register. backgroundColor = UIColor . lightGrayColor ( )
78
-
70
+
79
71
backgroundBlurView. frame = login. frame
80
72
backgroundBlurView. alpha = 0
81
73
backgroundBlurView. backgroundColor = UIColor ( red: 230 / 255 , green: 230 / 255 , blue: 230 / 255 , alpha: 0.5 )
@@ -86,14 +78,13 @@ class LoginViewController: UIViewController, UITextFieldDelegate {
86
78
loadingView. alpha = 0
87
79
loadingView. startAnimating ( )
88
80
89
- let offset = ( self . view. frame. height/ 2 ) - ( self . register . frame. maxY/ 2 )
90
- loginView. frame = CGRect ( x: 0 , y: offset, width: self . view. frame. width, height: self . register . frame. maxY)
81
+ let offset = ( self . view. frame. height/ 2 ) - ( ( self . login . frame. maxY + 20 ) / 2 )
82
+ loginView. frame = CGRect ( x: 0 , y: offset, width: self . view. frame. width, height: self . login . frame. maxY + 20 )
91
83
92
84
self . loginView. addSubview ( logo)
93
85
self . loginView. addSubview ( username)
94
86
self . loginView. addSubview ( password)
95
87
self . loginView. addSubview ( login)
96
- self . loginView. addSubview ( register)
97
88
self . loginView. addSubview ( backgroundBlurView)
98
89
self . loginView. addSubview ( loadingView)
99
90
@@ -124,13 +115,6 @@ class LoginViewController: UIViewController, UITextFieldDelegate {
124
115
}
125
116
}
126
117
127
- func register( sender: UIButton ) {
128
- let registerWebView = registerWebViewController ( )
129
- registerWebView. navigationController? . navigationBar. barTintColor = StaticVar . darkBackgroundColor
130
- let registerView = UINavigationController ( rootViewController: registerWebView)
131
- self . presentViewController ( registerView, animated: true , completion: nil )
132
- }
133
-
134
118
func checkLogin( ) {
135
119
let session = NSURLSession . sharedSession ( )
136
120
let username = self . username. text!
@@ -273,16 +257,16 @@ class LoginViewController: UIViewController, UITextFieldDelegate {
273
257
let keyboardFrame : CGRect = ( info [ UIKeyboardFrameEndUserInfoKey] as! NSValue ) . CGRectValue ( )
274
258
275
259
UIView . animateWithDuration ( 0.1 , animations: { ( ) -> Void in
276
- self . loginView. frame = CGRect ( x: 0 , y: keyboardFrame. minY - self . register . frame. maxY - 5 , width: self . view. frame. width, height: self . register . frame. maxY)
260
+ self . loginView. frame = CGRect ( x: 0 , y: keyboardFrame. minY - ( self . login . frame. maxY + 20 ) - 5 , width: self . view. frame. width, height: self . login . frame. maxY + 20 )
277
261
} )
278
262
}
279
263
280
264
func keyboardWillHide( notification: NSNotification ) {
281
265
print ( " Hide Keyboard " )
282
266
283
267
UIView . animateWithDuration ( 0.1 , animations: { ( ) -> Void in
284
- let offset = ( self . view. frame. height/ 2 ) - ( self . register . frame. maxY/ 2 )
285
- self . loginView. frame = CGRect ( x: 0 , y: offset, width: self . view. frame. width, height: self . register . frame. maxY)
268
+ let offset = ( self . view. frame. height/ 2 ) - ( ( self . login . frame. maxY + 20 ) / 2 )
269
+ self . loginView. frame = CGRect ( x: 0 , y: offset, width: self . view. frame. width, height: ( self . login . frame. maxY + 20 ) )
286
270
} )
287
271
}
288
272
@@ -299,23 +283,3 @@ class LoginViewController: UIViewController, UITextFieldDelegate {
299
283
return false
300
284
}
301
285
}
302
-
303
- class registerWebViewController : UIViewController {
304
-
305
- override func viewDidLoad( ) {
306
- self . navigationController? . navigationBar. barTintColor = StaticVar . darkBackgroundColor
307
- let doneButton = UIBarButtonItem ( title: " Close " , style: UIBarButtonItemStyle . Plain, target: self , action: " hideRegisterWebView: " )
308
- doneButton. tintColor = StaticVar . lightBackgroundColor
309
- self . navigationItem. setRightBarButtonItem ( doneButton, animated: false )
310
- self . navigationController? . navigationBar. barTintColor = StaticVar . darkBackgroundColor
311
- self . view. backgroundColor = StaticVar . darkBackgroundColor
312
-
313
- let webView = SMWebView . loadURL ( NSURL ( string: " https://vpn.ht/buy-vpn?_ref=ios " ) !)
314
- webView. frame = UIScreen . mainScreen ( ) . bounds
315
- self . view. addSubview ( webView)
316
- }
317
-
318
- func hideRegisterWebView( sender: UIBarButtonItem ) {
319
- self . dismissViewControllerAnimated ( true , completion: nil )
320
- }
321
- }
0 commit comments