简体   繁体   中英

iOS: Can I have a location based Launch Screen?

My app behaves differently based on the city you're currently in. I would like to display the city's name on the Launch Screen.

I will at first only support a few cities, so all I'd need would be the current location of the user and then match it against some hard coded locations in the app.

I'm pretty sure it's next to impossible to do this on the first app launch, since I will have to request user permission for the location, right?

But is it possible on the following launches, when I have the permission?

No. The LaunchScreen is static. You cannot change any displayed text or color or whatever at runtime. The only option is to use a launch screen where the city label is empty and create a splash screen (the first screen of your app) where you display the city name.

While your app is launching / starting there will not be a city name displayed, only after iOS finished starting your app you are able to do anything dynamic.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM