I have a document-based application. So I need an icon for my app as well as an icon for my documents.
In Xcode/Images.xcassets there is an item called AppIcon which I can use for setting the icon of the app.
But how do I make an icon for my documents?
Here is what I have tried under TARGETS/Document Types and TARGETS/Exported UTIs
I have tried different methods suggested on Internet but nothing works. The doc icon is always blank and empty as you can see below:
It turns out that if you change your icon you have to change the extension as well in order for the icon to show up.
So what I did was to first test without any icon getting an empty icon, and then tried to add the real icon. That did not work. Instead as soon as you add a new icon, also make sure to change the extension.
It is funny how such a little thing can make you lose a whole day, and also that I didn't find even a hint on this on the net.
Related
Somehow my find results started showing up on the bottom panel of sublime text instead of the normal, larger, main panel. i can't seem to figure out how to change it back.
i tried asking google, and looking through the preferences. help!
There's a button in the Find in Files panel that controls whether the find results are displayed in a Buffer or in a Panel. You want that to be set to the Buffer setting, so probably you inadvertently changed the setting.
To fix it, open up the Find in Files panel and ensure that the appropriate button is pressed. Below is an example based on the standard Adaptive theme in Sublime Text; the icon may be different for you if you're using a different theme, but the placement will be the same.
I have managed to do the proper dance and get a custom UTI set up for my OS X app's document type, with a custom file extension and so forth. I set up an icon for my file type as well, and that is also working. I know this because when I save a new file from my app, I can see it appear in the Finder with the correct icon. BUT – about a second later, the Finder replaces my icon with one of its generic "preview" icons, showing the text contents of my file inside the icon, with my file extension, capitalized, at the bottom of the preview icon, like this:
I think this is happening because I declare my custom UTI as having MIME type text/plain and conforming to public.utf8-plain-text. I do want to do that, because they are in fact text files, and I want to allow the user to treat them as such, other apps to recognize them as such, etc. But given this, the Finder (perhaps through some QuickLook generator or something) therefore says "aha, it's a text file, I know how to make custom preview icons for text files!" and replaces my custom icon. Which, needless to say, is not what I want. How can I prevent this from happening? I'm using Objective-C in my project, but I don't think this is a language-specific issue; it all has to do with the UTI declarations in my app's plist.
Speaking of which, here's a screenshot of the way my UTI is configured in Xcode:
And here's a screenshot of the UTI export in Xcode:
It is fine that the icon previews there show as question marks; that is because the icon images are included in my project as a .iconset folder that is turned into the requisite .icns file by Xcode at build time, and Xcode isn't smart enough to show the right preview. But as I said above, the correct icon does display for a second in the Finder, before it gets replaced by the preview icon, so the setup of the icon .icns file and the binding of the .icns to the UTI is clearly working. Along the same lines, if I do a "Get Info" on my file in the Finder, by the way, it shows the correct icon there in the upper left of the information window. The correct icon is also shown in the title bar of the window in my app. It is just in the Finder's display that the wrong icon is used. Any ideas?
Upon further experimentation, the best solution I've been able to find so far involves changing the "conforms to" field from public.utf8-plain-text to simply public.text. The public.text UTI is for text of any kind – any encoding, with or without markup, etc. Any more specific conforms-to UTI seems to lead to the Finder (or whoever it is) replacing my icon. But with public.text the icon is not replaced, presumably because whoever is doing this feels like they don't have enough information to proceed, since public.text is so generic.
This is really non-optimal, since it means that the encoding used for my files is not stated publicly in my UTI export info, making it less likely that other apps will be able to open my app's files as text. If anybody else has a better solution, I'd be happy to vote for it in preference to this answer. But for posterity, I've put this answer up since it might help someone else in a similar boat.
I have created a default [Swift] Cocoa application. I attempted to Ctrl drag from the default Open button in the menu to my View Controller in the assistant editor, but nothing happens.
Is my approach wrong? I assume there is some kind of default file chooser dialog, but I do not know how to make it appear or enable the Open menu item. From the documentation I feel I could make one appear programmatically, but I want to enable the menu button.
My first attempt at an OS X program hit a wall very fast :-/
First, control-Click on Open, and see if it is already attached to a function. If so, click the x to detach it, then try again.
Second, be very sure that the Assistant Editor is presenting the correct file to do the control-Drag. I have found that I need to manually choose the correct file much of the time.
I am currently watching the video tutorials series by TheNewBoston concerning iPhone development. Unfortunately, he uses Xcode 3 in his tuts so when showing the viewers what exactly should be done to complete certain steps, it is quite difficult to follow along. Here's what I've found that isn't parallel, some of which I am figuring out as I go along, but some is still ambiguous and would be great to be clarified on the site:
Resources is supposed to be the same as 4's 'Supporting Files' folder, however doesn't contain the ViewController files I'm looking for that he demonstrates on. (How do I get to the View display?)
There's no 'tools' top menu bar option
Under this I should be able to find the option item 'Library' which contains 'Attributes' (Where are all of these components located?) - (Actually as I'm going along I'm finding some of these, but for the sake of the site's Q&A style I'll pose the question regardless.)
"Build and Run" button on home toolbar is the same as the "Run" button in 4?
I clicked the Run button and it built, but I have a big white box rectangle after I was told to put the "Bacon" label on the View Controller (which I ended up finding) - what's up with that?
When trying to add an icon to the plist file, the option to do so on the chart is not featured - where is it?
Bucky chooses a View Based Application setting when creating a new project. This is not an option in Xcode 4. What is its closest relative?
What Bucky shows is actually not under the Supporting Files folder, just under the project folder. It will not have the ".xib" ending, but rather a ".storyboard" ending.
True. Sorry.
The Library you are looking for is in the bottom right hand corner of the window. It is one of the tabs that is currently displaying the "File Template Library". Two tabs down is the object library you're looking for.
Yes.
Likely, you were creating display components under the iPhone storyboard, and the option bar just a couple buttons right of the Run button will give you the option to display the iPhone simulator. It is possibly set to the iPad display at the moment.
You must create the property. Click on one of the properties and a (+) sign will display when the item is highlighted. Click it and a new property value will come up to be defined and type in "Icon File." Ergo, you are ready to follow further into the video tut.
Although I am not certain I believe it is known as the "Single View Application" option. It seems to me that they have the same properties.
This is a mac thing (because text edit does the same) but I just want to change this in xcode.
I'd like the cursor to move when I hit the page-up and page-down button. Kind of like the way windows or linux work. I know I can hold down the "option" button and then go page-up, page-down and it works - but I don't want to hold the option button.
I tried fiddling around with key bindings in xcode but couldn't get it, anyone know how?
In preferences, go to key bindings, type "page" in the search box, look for Page Down (Selection) / Page Up (Selection), click there and hit your pgdn/pgup keys.
Delete the pgdn/pgup keys from Scroll Page Up/Down.
Whit Xcode 6.1 (and >) is quite different, but similar to Colin's answer.
Xcode > Preferences > Key Bindings
Search for "Move Page Up": by default it's bindend with Alt+PgUp
You can change your binding simply with PgUp.
There may be conflicts, resolve it is suggested.
Than repeat the same for "Move Page Down".
Install KeyRemap4MacBook and life will be good. If you have a PC/Mac/Linux environment the MacOS keyboard inconsistencies can be a real pain. We have all of our Macs setup to work as PC keyboards work. Now switching from one system to the other several times a day is not a problem.