I am trying to add icons to the document type I have defined using Xcode document type option on the project info.
See the phrase add icons here
? In theory you can drop icons to that area. I have tried png, ico, icns. Nothing.
I have tried to add the icons by clicking on the +
there, nope. I click on the +
, I choose the files and nothing happens.
The icon you see there I was able to drop to the place it is, that is another droppable place.
My problem is this:
I use the following code to obtain the icon at run time and display it.
UIDocumentInteractionController* docController = [[UIDocumentInteractionController alloc] init];
docController.name = [NSString stringWithFormat:@"x.%@", [[fileURL path] pathExtension]]; // it is x, but it can be anything
NSArray *icons = (NSArray *)[docController icons];
The array I get has two icons, both with the same size that is 37x48 in size (???!!!)
two questions
Apple documentation is vague. I don't know if these icons have to have a special nomenclature. My big icon is something like bigIcon.png
and the small one is smallIcon.png
.
required icon sizes are
you have to modify .plist manually (i didn't find another way yet)
<key>CFBundleDocumentTypes</key>
<array>
<dict>
<key>CFBundleTypeIconFiles</key>
<array>
<string>icon320x320.png</string>
<string>icon64x64.png</string>
<string>icon44x58.png</string>
<string>icon22x29.png</string>
</array>
<key>CFBundleTypeName</key>
<string>mydocumenttype</string>
<key>CFBundleTypeRole</key>
<string>Viewer</string>
<key>LSHandlerRank</key>
<string>Owner</string>
<key>LSItemContentTypes</key>
<array>
<string>xyz.mydocument.uti</string>
</array>
</dict>
</array>