4

The calender app does it... How can I make an app icon change based on stored info from the iPod or iPod app settings?

EDIT: I realized today that it is possible to access bundles via the sdk. (At least read access) If I had a graphics API (OpenGL, perhaps) then I could possibly modify the icon like that. The operation would be:

  • get icon.png from bundle.
  • modify it
  • resave it into the bundle.

Does that make sense?

Moshe
  • 57,511
  • 78
  • 272
  • 425

4 Answers4

5

Just as a note, Apple's Calendar app is actually hardcoded into the system to display a view over the icon. Put it on the left of the first page and drag to SpotLight, you will notice that the text fades out differently.

Grant Paul
  • 5,852
  • 2
  • 33
  • 36
  • Interesting observation. Wierd though. – Moshe Mar 19 '10 at 03:34
  • It's due to the fact that since it is a black text view over a white background, it fades to white, but the icon itself fades to black since it becomes invisible. To do it correctly, they would have to not fade the calendar text. – Grant Paul Mar 20 '10 at 05:12
3

Unfortunately you can't use the SDK (which of course Apple isn't restricted to with the Calendar app) – you can do badges but the image is always static.

omz
  • 53,243
  • 5
  • 129
  • 141
Jon
  • 16,212
  • 8
  • 50
  • 62
  • Ok. I'll be that's why (among other reasons) the calender API is nonexistent from Apple. Thanks. – Moshe Mar 11 '10 at 02:08
2

In answer to your edit: no, you cannot alter any files inside your bundle; your application is sandboxed to only have write access within its documents, cache, and temporary directories.

Noah Witherspoon
  • 57,021
  • 16
  • 130
  • 131
  • What if the plist referenced a file inside the sandbox? – Moshe Mar 19 '10 at 03:33
  • 1
    I heard of some hack that made something like that happen... the file being a symlink inside the bundle, or something like that. It was a while ago, though—there's a good chance it's been fixed by now. – Noah Witherspoon Mar 19 '10 at 16:43
1

It's possible in new iOS 10.3 update(beta version) but you will have to specify each icon in the info.plist file.

func setAlternateIconName(_ alternateIconName: String?, 
    completionHandler: ((Error?) -> Void)? = nil)

alternateIconName

Donald Duck
  • 8,409
  • 22
  • 75
  • 99
swiftyAmit
  • 21
  • 2
  • Checked documentation but still confused about how to implement it, in the sense of clear use case? – Catarino Mar 28 '17 at 21:38
  • @Catarino https://www.hackingwithswift.com/example-code/uikit/how-to-change-your-app-icon-dynamically-with-setalternateiconname – Tom Kidd May 01 '17 at 22:01