Book Image

Mac Application Development by Example: Beginner's Guide

By : Robert Wiebe
Book Image

Mac Application Development by Example: Beginner's Guide

By: Robert Wiebe

Overview of this book

It's never been more important to have the ability to develop an App for Mac OS X. Whether it's a System Preference, a business app that accesses information in the Cloud, or an application that uses multi-touch or uses a camera, you will have a solid foundation in app development to get the job done.Mac Application Development by Example takes you through all the aspects of using the Xcode development tool to produce complete working apps that cover a broad range of topics. This comprehensive book on developing applications covers everything a beginner needs to know and demonstrates the concepts using examples that take advantage of some of the most interesting hardware and software features available.You will discover the fundamental aspects of OS X development while investigating innovative platform features to create a final product which take advantage of the unique aspects of OS X.Learn how to use Xcode tools to create and share Mac OS X apps. Explore numerous OS X features including iCloud, multi-touch trackpad, and the iSight camera.This book provides you with an illustrated and annotated guide to bring your idea to life using fundamental concepts that work on Mac.
Table of Contents (17 chapters)
Mac Application Development by Example Beginner's Guide
Credits
About the Author
About the Reviewers
www.PacktPub.com
Preface
Index

Time for action - configuring the SimpleCalc Xcode project


To change the Mac OS X deployment target for our project we need to do the following:

  1. In the project navigator, click the folder icon to show the project navigator.

  2. In the project navigator, click on the very top item, just under the icons, named SimpleCalc.

  3. Under PROJECT, click on SimpleCalc.

  4. Under Deployment Target, click on the drop-down menu beside Mac OS X Deployment Target and select the oldest version of Mac OS X on which we want our App to run as shown in the following screenshot:

  5. Change TARGETS setting for the Organization of the Project Document to our name or the name of our company as shown in the following screenshot:

  6. Before we continue to configure our Xcode target, we need to take a small detour and create an App Icon. We are going to need our App Icon as part of the process of configuring an Xcode target.

  7. The first thing we need to do is create the icon. We can do this in any image editing program, from Illustrator, to Photoshop, to Gimp. The program that we use does not matter. What matters is that the image has a transparent background and that the image size is 512 x 512 pixels. We need to export our image in PNG format and it may look like the following image, which has been created in Photoshop Elements:

    Note

    Apple recommends we create App Icon images in a variety of different sizes ranging from 16 x 16 to 1024 x 1024. If we were building an App to deploy in the App Store, we would create more than a single 512 x 512 icon but for our SimpleCalc App a single icon is all we need.

  8. Once we have the image that we want to use as our icon, we need to save it in a folder named SimpleCalc.iconset with the name icon_512x512.png.

    Note

    The filename must be exact. If you name it anything other than icon_512x512.png the icon will not be correctly updated and you will see a generic icon instead of your App Icon.

  9. Once we have our PNG image saved in the iconset folder, we simply drag that folder to the App Icon section of our project target and Xcode will automatically convert it to a suitable .icns file as shown in the following screenshot:

  10. Because we have not provided all the required image sizes, Xcode will warn us that some image sizes are missing. For the purposes of our SimpleCalc App we can ignore these warnings but if we planned to deploy our App to the Mac OS X App Store we would create a PNG file for each required icon size and place it in our iconset folder prior to dragging the folder in to the App Icon section of the Target as shown in the following screenshot:

What just happened?

When we set up the Deployment Target and App Icon, we made changes to our Xcode project. Xcode will use those changes and apply them to the App when we build it so that the App is ready to run on the versions of Mac OS X that we need and the Finder will display our unique icon to identify our App on the desktop.

Have a go hero – make your own icon

Create your own 512 x 512 bitmapped image, save it in .png format, and put it in the iconset folder for the SimpleCalc App. You can use any image editing software that you like. You may want to create all of the required image sizes so that you don't get warnings from Xcode. The following screenshot shows the images of all required sizes present in the SimpleCals.iconset folder:

If you need a free bitmap editor take a look at Gimp for Mac OS X:

http://www.gimp.org/downloads/