How to create drag-and-drop installer for MacOS X? - macos

What tools are used to create installers like this:
EDIT:
Here's a full tutorial: http://chromasoft.blogspot.com/2010/02/building-dmg-installer-for-mac-simple.html

It's just a folder with a custom background image (right click on the folder background and select "Show View Options"; Firefox also sets a larger icon size and adjusts the grid to match, also in the same place). The link to /Applications is created by Control-dragging. Once you have the original folder set up, you can use hdiutil to create a DMG disk image from the folder.

goin to Disk Utility
File>New Image>Blank Image
Select the Settings (Size must be lager than files you want to store)
Open DMG to mount the image
Drag into the folder of image your App, and an Applications Folder Alias.
Right-Click on image folder>Show View Options .
And then you can customize your background, etc.

Related

How can I add a custom document icon to my documents in a document-based Mac app?

To get custom document icons, do I need to add a new “Icon” set in Xcode’s Assets.xcassets folder by selecting Editor > Add Assets > App Icons & Launch Images > New macOS Generic Icon? Or do I just add a .icns file with appropriate sizes to the Assets.xcassets folder?
Also, I can’t find in the macOS Human Interface Guidelines what a custom document icon should look like. Most of them resemble Apple’s generic document icon with the custom file extension added at the bottom in all caps (TXT, DOCX, etc.). Do we copy Apple’s generic document icon and modify it by adding our own graphic (centered) and extension name across the bottom of it? (If so, where can that template be found?) Do we create another version of that same icon with a preview of the first page of our document (instead of the graphic)—or is that handled by the system automatically? I’ve seen both types of document icons in Finder windows.
If there is any documentation that gives a workflow for creating custom document icons for a Mac or iOS app, I would truly appreciate a reference. I’ve done an enormous amount of reading, but this is my first app. So a step-by-step answer would be most helpful.
Using Assets.xcassets does not really work that well (still with Xcode 10). I'd suggest the following steps:
Generate a ICNS file out of a PNG or TIFF file you designed for your documents, using one of the icon generator tools available in the App Store (see below on how to design a document icon).
Drag the ICNS file into your project (select copy if needed).
Switch to the target settings of your project, select the Info tab. There should be an entry in Document Types.
Select the name of the ICNS file in the drop down menu next to Icon in the document entry.
This should do it. You should see the icon in the document entry. Sometimes the Finder does not display this right away when you save a document, but maybe after a reboot.
On getting a generic document icon: If you save a document from your app without applying an icon to it first, it will show the generic icon. Do a "Get Info" from Finder, select the small icon next to the name on top of the info window and paste the TIFF into some graphic app for editing. GraphicConverter for example features New from clipboard which makes that easy.
You can also get this icon from
/System/Library/CoreServices/CoreTypes.bundle/Contents/Resources/GenericDocumentIcon.icns, but then it is in ICNS format already.

How to change folder icon in C Drive

I want to change the folder icon in C drive. When I go onto the tab "Customize" in folder Properties, choose an icon and then apply, nothing happens.
You can use FileTypesMan,a nirsoft tool that allows you to do a lot of things.
Dowload FileTypesMan and open it.
Locate your type of file (like image, or folder for exemple)
Click on it and select "Edit Selected File Type"
Change defaut icon and confirm
An example for png file :
Example to change png type files

Opening DMG Files in a new Finder window

I have made a .dmg file for my application but, when I open up my .dmg file it opens with the sidebar included. It most of the applications I have seen, the .dmg file opens up a new Finder window without the sidebar. How would I acheive this?
You can control that by creating a .DS_Store - This is a "Directory Services" Store file, which is used by Finder to setup the position of the various icons in the folder, etc. The problem is, the format is very poorly documented. However, there is a workaround: Open up your to-be-in-DMG folder prior to packaging the DMG, make it so that the sidebar is hidden, and then create the DMG. When the DMG is created, it will contain the .DS_Store hiding the sidebar. You can see a bit more on this in https://apple.stackexchange.com/questions/69467/consequences-of-deleting-ds-store
The easiest way to do this is just to pay for one of the utilities out there that builds disk images for you.
I use dropdmg, but there are plenty of others. (I'm not affiliated to any of them)

Save image in a folder and directly use XCode

I was wondering whether it is possible to save an image you just edited in Photoshop, and immediately it is useable in XCode, instead of dragging the image into XCode all the time.
You could create a folder reference to the location you are saving your images.
To do this, use the "Add Files to 'NameOfProject'" menu command, then select your folder. Ensure that the options are set as follows:
Then the images should appear in Xcode when you view the contents of that folder. When referencing them, you must use the name of the folder. E.g. [UIImage imageNamed:#"MyImages/image.png"];

How can I set the icon for a Mac Application in Xcode?

I have been learning a lot about writing Objective-C code and designing in Interface Builder and I wanted to set icons for my simple programs.
I added the same JPG to all the size fields in Icon Composer and got an ICNS, but I couldn't figure out how to add it to the project.
Thank you in advance.
Since Xcode 4.4 Icon Composer is no longer the recommended way to create icons and is no longer included in the standard install of Xcode.
Due to the introduction of Macs with retina display, it is now recommended to provide high resolution versions of all graphics including app icons.
To give your app an icon under Xcode > 4.4 do the following:
Create a folder [IconName].iconset in Finder
In this folder place your icon as png files. You'll need the icon in
sizes of 16px, 32px, 64px (retina only), 128px, 256px, 512px and
1024px (retina only)
These icons must be named with the pattern icon_16x16.png,
icon_32x32.png, icon_128x128.png and so on
To support retina displays you must also add icon files with double
resolution, named icon_16x16#2x.png (with size 32x32),
icon_32x32#2x.png (size 64x64) and so on up to icon_512x512#2x.png (size 1024x1024).
drag this [IconName].iconset folder to Xcode (copy if necessary)
in the info.plist file set the "CFBundleIconFile" (Icon File as Key) value to
[IconName] but without the .iconset extension
Annotations:
it is (currently) not required to provide the #2x icons
it will (usually) also work if you don't provide every icon file
the iconset folder should not contain a icon_64x64.png file. the 64px icon is only for the retina version of the icon_32x32
Update:
In the end your .iconset folder has the following 10 items:
icon_16x16.png
icon_16x16#2x.png
icon_32x32.png
icon_32x32#2x.png
icon_128x128.png
icon_128x128#2x.png
icon_256x256.png
icon_256x256#2x.png
icon_512x512.png
icon_512x512#2x.png
Official guide:
https://developer.apple.com/library/content/documentation/GraphicsAnimation/Conceptual/HighResolutionOSX/Optimizing/Optimizing.html
Additional information:
To convert the iconset folder to an icns file, run the following command on the terminal:
iconutil -c icns [IconName].iconset
where [IconName] should be replaced with the prefix of the iconset folder. You now have a file called [IconName].icns. In Xcode 4.4, in the Target Summary, right click the question mark for the icon, then select the icns file. You should then see the question mark get replaced with the icon.
As of Xcode 7 (not sure when this was originally introduced), you can use the Assets.xcassets file for app icons. This file is included by default for new projects.
Simply:
Go to your target's settings and ensure that under General, App Icons the Source is set to AppIcon.
Add all 10 png icons to your Assets.xcassets's AppIcon image.
Delete derived data if you have launched the app before, otherwise it will continue to show the default icon.
Run the app; it should now show your icon in the Dock, Application Switcher, and anywhere else it should appear.
Follow these steps to add an application icon to your project. This is the icon that will be show by the MacOS in the doc bar and alt-tab display.
Create an icon .icns resource file
Place it in the "resources/macos" folder
Add it to the resources group in the xcode project
Edit the Info.plist file and change the "CFBundleIconFile" value string to "icon"
Also, img2icns tool can come handy to convert images to an icon.
It's easy
Use automatic tool (Such as IconFly) for create correct ICNS or iconset with all necessary size.
Then drag and drop created ICNS or iconset to Xcode.
in the info.plist file set the "CFBundleIconFile" value to [IconName]
Steps to add an application icon to your cocoa project.
Find 'Icon Composer' from spotlight.
Drag and drop the icon(name should be like imagename.icns) in the given boxes.
Select one box and save it.
Drag and drop the saved image in the Resources folder of your application.
Select target-->right click on project name-->Select GetInfo.
In Properties enter the name of 'Icon File'.
Now Clean Build and run your application.
Xcode 8.2.1
Convert .png 👉.icns via IconMaker
Add the AwesomeApp.icns file in the same folder as info.plist
Drag AwesomeApp.icns file into xcode in the same folder as info.plist
In info.plist set icon: to AwesomeApp.icns
Step 1: Get iconfile name from info.plist and place icns(icon file) folder in SourceCode/resources folder
Step 2: And same thing goes for xcode,you have to copy all images from xcode using copyallframeworks or copyall resource file in your xcode and build the app again.

Resources