How to show the boot counter / indicator when starting InAppBrowser for the iOS version for Cordoba

We are trying to display an indicator that loads a web page when launching an instance of InAppBrowser in the iOS version of Cordova 3.4.

Android works fine with the spinner at the bottom, but iOS shows nothing but a white screen until the page pops up.

First, we studied the use of event listeners:

https://github.com/apache/cordova-plugin-inappbrowser/blob/dev/doc/index.md#addeventlistener

to listen to loadstart and loadstop and add js / css to show loading in appbrowser window

https://github.com/apache/cordova-plugin-inappbrowser/blob/dev/doc/index.md#executescript as well as https://github.com/apache/cordova-plugin-inappbrowser/blob/dev/doc /index.md#insertcss

Continuing to work on a viable solution.

+4
source share
2 answers

The iOS InAppBrowser object has its own counter, which automatically adds to the web view.

However, since the spinner is created as a UIActivityIndicatorViewStyleWhite, and the background of the web view is white, you cannot see it.

So, I updated it like this:

self.spinner = [[UIActivityIndicatorView alloc] initWithActivityIndicatorStyle:UIActivityIndicatorViewStyleGray];

In addition, the x coordinate of the raster frame is outside the iPhone. To fix this, I updated the frame to:

self.spinner.frame = CGRectMake(self.view.frame.size.width / 2 - 10, self.view.frame.size.height/ 2 - 10, 20, 20);

This should center the spinner no matter what size of device you are using.

I tested this only in portrait mode.

( 3.4) , "" .

+11

, Phonegap Build, , , (spinner) , iOS.

config.xml Phonegap InAppBrowser , , Goku:

<gap:plugin name="com.cordova.plugin.inappbrowser.with.loading.spinner" version="1.0.2" />

0

Source: https://habr.com/ru/post/1534558/


All Articles