Paul Morris
Paul Morris

Reputation: 1773

Generating a random default screen on iOS

One of the prerequisites within Xcode is setting the 'Default' and 'Default@2x' images for when the iPhone app loads up.

Is it all possible to have a number of Default screens made, inserted into the project in png format and each time the app is loaded, choose a random default screen to use?

Upvotes: 5

Views: 1895

Answers (3)

Derek Munneke
Derek Munneke

Reputation: 157

You can change the default screen in iOS (at least after first launch) by setting UILaunchImageFile property in the info.plist, and then writing a new image to the Documents folder.

eg.

<key>UILaunchImageFile</key>
<string>../Documents/NewDefault.png</string> 

then write your random splash to /Documents/NewDefault.png.


Seems i have to be more prescriptive... I am not suggesting you modify anything in your app bundle at runtime, as has been said, that cannot occur.

But because the /Documents folder sits next to the .app folder, you can set the UILaunchImageFile via a relative path, and then put a file at the path specified when the app runs.

Upvotes: 8

Filip Radelic
Filip Radelic

Reputation: 26683

There is no way to change the startup screen without rebuilding the app. It's name is either hardcoded in info plist or is set to the default value of "Default.png" if nothing is set in the plist.

Since both the image file and plist file are inside app's bundle which is digitally signed, even if you could change any of them (you can't as it's read-only), your app's signature would invalidate and crash on non-jailbroken devices.

Upvotes: 1

Eimantas
Eimantas

Reputation: 49354

You cannot change Default.png. Once the app is shipped - it's "set in stone". Until the next release, that is. The reason is simple (and same why you can't change apps icon). App's bundle is read-only. It is made read only because it is signed by you and by apple. Modifying the contents of the bundle would invalidate the signature.

Upvotes: 8

Related Questions