Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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?

like image 565
Paul Morris Avatar asked Aug 30 '11 12:08

Paul Morris


2 Answers

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.

like image 84
Eimantas Avatar answered Oct 19 '22 15:10

Eimantas


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.

like image 8
Derek Munneke Avatar answered Oct 19 '22 15:10

Derek Munneke