@@ -84,30 +84,38 @@ - (BOOL)handleSpecialUrls:(NSURL*) url
84
84
85
85
- (void )viewDidLoad {
86
86
[super viewDidLoad ];
87
-
88
- WKPreferences * preferences = [[WKPreferences alloc ]init];
89
- preferences.javaScriptEnabled = YES ;
90
- WKWebViewConfiguration * config = [[WKWebViewConfiguration alloc ]init];
91
- config.preferences = preferences;
92
- WKWebView * view = [[WKWebView alloc ]initWithFrame:CGRectMake (0 , 0 , self .view.bounds.size.width, self .view.bounds.size.height) configuration: config];
93
- view.navigationDelegate = self;
94
- self.webView = view;
95
- [self .webView setAutoresizingMask: UIViewAutoresizingFlexibleHeight | UIViewAutoresizingFlexibleWidth];
96
87
}
97
88
98
89
- (void )viewWillAppear : (BOOL )animated {
99
90
[super viewWillAppear: animated];
100
-
101
- self.spinner = [[UIActivityIndicatorView alloc ]initWithFrame:CGRectMake (0 , 0 , self .view.bounds.size.width, self .view.bounds.size.height)];
91
+ }
92
+
93
+ -(void )viewWillLayoutSubviews {
94
+ [super viewWillLayoutSubviews ];
95
+ self.spinner = [[UIActivityIndicatorView alloc ]initWithFrame:self .view.bounds];
102
96
[self .spinner setColor: [UIColor grayColor ]];
103
97
[self .spinner startAnimating ];
104
98
99
+ WKPreferences * preferences = [[WKPreferences alloc ]init];
100
+ preferences.javaScriptEnabled = YES ;
101
+ WKWebViewConfiguration * config = [[WKWebViewConfiguration alloc ]init];
102
+ config.preferences = preferences;
103
+ WKWebView * webview = [[WKWebView alloc ]initWithFrame:self .view.bounds configuration: config];
104
+ webview.navigationDelegate = self;
105
+ [webview setAutoresizingMask: UIViewAutoresizingFlexibleHeight | UIViewAutoresizingFlexibleWidth];
106
+ // Make webview transparent
107
+ webview.opaque = NO ;
108
+ webview.backgroundColor = [UIColor clearColor ];
109
+ self.webView = webview;
110
+
105
111
[self .view addSubview: self .webView];
106
112
[self .webView addSubview: self .spinner];
107
113
108
- NSURL *urlAddress = [NSURL URLWithString: self .queueUrl];
109
- NSURLRequest *request = [NSURLRequest requestWithURL: urlAddress];
110
- [self .webView loadRequest: request];
114
+ [self .webView loadRequest: [NSURLRequest requestWithURL: [NSURL URLWithString: self .queueUrl]]];
115
+ }
116
+
117
+ -(void )viewDidAppear : (BOOL )animated {
118
+ [super viewDidAppear: animated];
111
119
}
112
120
113
121
- (void )viewDidDisappear : (BOOL )animated
0 commit comments