Changing the position of the spinner on iOS #3508
Replies: 4 comments
-
@webeditors This is the first I've heard of someone wanting to configure that! If you think it makes sense as a public API, please create a feature request in this repo for the Capacitor 3 Splash Screen plugin: https://github.com/ionic-team/capacitor-plugins/ |
Beta Was this translation helpful? Give feedback.
-
In my forthcoming SplashScreen plugin (which hopefully will be adopted by Capacitor), you can use a storyboard as your launch screen. So you can put a spinner anywhere you want right the storyboard designer and control its positioning intelligently using constraints. |
Beta Was this translation helpful? Give feedback.
-
Nothing new? it would be very useful |
Beta Was this translation helpful? Give feedback.
-
you can add more options like bottom | top | center |
Beta Was this translation helpful? Give feedback.
Uh oh!
There was an error while loading. Please reload this page.
-
Plenty of Google results for this request on the Cordova Splash Screen Plugin, but I could find nothing for Capacitor's native plug in, so after a bit of poking around I figured out a solution. I think...
The problem: The spinner on the Splash Screen is fixed to the centre of the screen. That's normally where the App logo is, so not ideal.
In you XCode project, navigate to Pods > Development Pods > Capacitor > Plugins > SplashScreen.swift
On line 128 and again on 164 you should find
self.spinner.centerYAnchor.constraint(equalTo: view!.centerYAnchor).isActive = true
This determines where the spinner is vertically in the view (the line above is the horizontal position, but I figure most will want to keep that centered horizontally).
Change that line to
self.spinner.bottomAnchor.constraint(equalTo: view!.safeAreaLayoutGuide.bottomAnchor).isActive = true
The reason you use safeAreaLayoutGuide.bottomAnchor and not just .bottomAnchor is otherwise the spinner will appear over the gesture area at the bottom.
I've only tried this in the simulator so far, so don't know how reliable this is, but may be a solution for others trying to move the spinner.
Now.. how do i do this for Android, I wonder...
Beta Was this translation helpful? Give feedback.
All reactions