{"id":10698,"date":"2011-11-08T21:03:07","date_gmt":"2011-11-08T13:03:07","guid":{"rendered":"https:\/\/www.hongkiat.com\/blog\/?p=10698"},"modified":"2025-04-04T00:43:45","modified_gmt":"2025-04-03T16:43:45","slug":"ios-development-guide-part2-your-first-app","status":"publish","type":"post","link":"https:\/\/www.hongkiat.com\/blog\/ios-development-guide-part2-your-first-app\/","title":{"rendered":"iOS Development Guide: Creating Your First App (Part II)"},"content":{"rendered":"<p>In the <a href=\"https:\/\/www.hongkiat.com\/blog\/ios-development-guide-part1\/\">first part of our iOS tutorial<\/a>, we took you through an introduction to iPhone app development. We explored Xcode 4 and covered a basic tutorial on building an iPhone app. This beginner tutorial was designed for anyone interested in learning how to program iOS apps.<\/p>\n<p>Today, we\u2019ll delve into the second segment of the topic, where we will be <strong>building a fully-functioning iPhone application<\/strong>. The app, with tabbed navigation, will <strong>convert temperature units and distance units<\/strong>. Don\u2019t worry if you\u2019re still new to Xcode. It doesn\u2019t take long to get comfortable with the interface. I\u2019ll explain each step in detail so you won\u2019t get lost!<\/p>\n<p>By the end of the tutorial, you will have an application that, while it can\u2019t be pushed to an iPhone without purchasing a developer program, can be run inside the iOS Simulator on a macOS system. I\u2019ve provided the project files for download, which you can refer to if you\u2019re unsure about any step. Ready to build an app? Let\u2019s get started!<\/p>\n<p><em>Note: You will need a computer with the Macintosh Operating System (macOS) for Xcode installation, application development, and app submission. There is no legal way to do this on Windows.<\/em><\/p>\n<h2>Pre-Setup: Installing Xcode Packages<\/h2>\n<p>If you haven\u2019t done so already, you will need to get <strong>Xcode 4<\/strong> on your computer. You <strong>must use Xcode 4<\/strong> since this tutorial is written specifically for Xcode 4. If you\u2019re running the latest macOS Lion, a simple search in the <strong>App Store<\/strong> will provide everything you need. Xcode 4 includes the iOS SDK & Simulator for building and running iPhone apps directly on your Mac!<\/p>\n<figure><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/assets.hongkiat.com\/uploads\/ios-development-guide-part2\/xcode.jpg\" alt=\"Xcode interface\" width=\"500\" height=\"318\"><\/figure>\n<p>If you cannot find Xcode 4 in the App Store, you can also try accessing the <a rel=\"nofollow noopener\" target=\"_blank\" href=\"https:\/\/developer.apple.com\/xcode\/\">official Xcode page<\/a> to download the software. Otherwise, you\u2019ll need to find the software in your developer account, which you can <a rel=\"nofollow noopener\" target=\"_blank\" href=\"https:\/\/idmsa.apple.com\/IDMSWebAuth\/signin?appIdKey=891bd3417a7776362562d2197f89480a8547b108fd934911bcbea0110d07f757&path=%2Fregister%2Fagree%2F&rv=1\">register for<\/a> without a fee on the Apple Developer site.<\/p>\n<p>You could also check on Google if you\u2019re having difficulty finding the software. Apple tries to keep their developers more private and refined, so it can be a struggle getting everything set up to begin programming. Luckily, Xcode is a <strong>one-time install<\/strong> that includes all the SDK components you\u2019ll need for iPhone app development.<\/p>\n<p>After the installation is completed, open your new software and let\u2019s build this iPhone app!<\/p>\n<h2>Creating Your New Project<\/h2>\n<p>Open Xcode 4 and you should see a startup screen with a few default options. From the list, <strong>select \u201cCreate a new Xcode project\u201d<\/strong> to open the main window. Here, you have the choice to select which template to begin with. We\u2019re going to use the <strong>Tabbed Application<\/strong>.<\/p>\n<figure><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/assets.hongkiat.com\/uploads\/ios-development-guide-part2\/tabbed-application.jpg\" alt=\"Tabbed Application template in Xcode\" width=\"600\" height=\"404\"><\/figure>\n<p><strong>Click \u201cNext\u201d<\/strong> and you need to <strong>enter a name for your project<\/strong>. I\u2019ve chosen <em>Converter<\/em>. Next, you need to <strong>enter the Company Identifier<\/strong>, such as <em>com.hongkiat<\/em>, which is used to sort the internal build directories of your application. Make sure you <strong>select \u201ciPhone\u201d from the Device Family<\/strong>, and <strong>ensure all options below are checked<\/strong>. <strong>Click \u201cNext\u201d<\/strong> and <strong>choose a location to create<\/strong> all the project files.<\/p>\n<figure><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/assets.hongkiat.com\/uploads\/ios-development-guide-part2\/project-options.jpg\" alt=\"Project options setup in Xcode\" width=\"600\" height=\"404\"><\/figure>\n<p>In the left pane, you\u2019ll notice the <strong>Project Navigator<\/strong> with a whole new set of files. <strong>Click on the \u201cConverter\u201d file<\/strong> to view all files inside. Beside the Project Navigator is the <strong>Document Outline<\/strong>. <strong>Remember these names<\/strong> since we\u2019re going to use them throughout the entire tutorial.<\/p>\n<figure><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/assets.hongkiat.com\/uploads\/ios-development-guide-part2\/mainstoryboard-storyboard.jpg\" alt=\"MainStoryboard storyboard view in Xcode\" width=\"600\" height=\"442\"><\/figure>\n<p>You should notice three very important files: <strong><em>MainStoryboard.storyboard<\/em><\/strong>, <strong><em>FirstViewController.h<\/em><\/strong>, and <strong><em>FirstViewController.m<\/em><\/strong>. The .h and .m files are used for header and implementation code, which essentially connects the back-end programming with our front-end buttons and text fields. You should see matching files, <em>SecondViewController.h<\/em> and <em>SecondViewController.m<\/em> for the Second View as well.<\/p>\n<p>The storyboard file was originally a <strong><em>.xib<\/em><\/strong> (pronounced <em>nib<\/em>) file that was ported over from Interface Builder. The newest release of Xcode 4.2 actually ties this functionality into a type of flowchart to make editing a bit easier. When creating a new project, you can <strong>uncheck the storyboard option<\/strong> and you\u2019ll have individual <em>.xib<\/em> files for each view. If you feel more comfortable with the old file system, you can use that, but for this tutorial, you must <strong>stick to the storyboard method<\/strong>.<\/p>\n<h2>Custom Tab Bar Icons<\/h2>\n<p>We will start building the interface components first and move onto Objective-C programming later. To begin, let\u2019s <strong>replace the label text with icons in the tab bar<\/strong>. First, <strong>download the <a rel=\"nofollow noopener\" target=\"_blank\" href=\"https:\/\/www.glyphish.com\/\">Glyphish icon set<\/a> to your Desktop<\/strong>. They offer a pro set with 2X icons for iPhone 4 retina display, but we can work with the free standard icons for this tutorial.<\/p>\n<figure><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/assets.hongkiat.com\/uploads\/ios-development-guide-part2\/add-files-to-group.jpg\" alt=\"Adding files to group in Xcode\" width=\"600\" height=\"442\"><\/figure>\n<p>Back in Xcode, in your Project Navigator, <strong>right-click on the first yellow folder<\/strong> which contains your main views and <strong>select \u201cAdd files to <em>Group<\/em>\u2026\u201d<\/strong>. The <em>Group<\/em> should be titled according to your project name; in this case, it\u2019s <em>Converter<\/em>.<\/p>\n<figure><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/assets.hongkiat.com\/uploads\/ios-development-guide-part2\/add-images-to-group.jpg\" alt=\"Adding images to group in Xcode\" width=\"600\" height=\"320\"><\/figure>\n<p>A new window will open to select files to add to Xcode. <strong>Choose the Glyphish icon file located on your Desktop<\/strong> (or wherever you saved it) and <strong>inside the <em>icons<\/em> folder<\/strong>, <strong>choose the <em>61-brightness.png<\/em><\/strong>. <strong>Click \u201cAdd\u201d<\/strong> so they\u2019ll be imported into your project directory. <strong>Repeat the same process to add <em>07-map-marker.png<\/em><\/strong> to the project directory.<\/p>\n<figure><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/assets.hongkiat.com\/uploads\/ios-development-guide-part2\/document-outline.jpg\" alt=\"Document outline in Xcode\" width=\"600\" height=\"427\"><\/figure>\n<p>Now, <strong>select <em>MainStoryboard.storyboard<\/em><\/strong> to open the visual editor in the center of the software. To the left, you\u2019ll notice a new menu on the right side of the Project Navigator, called the <strong>Document Outline<\/strong>. This is a documented list of all the elements, pages, views, and navigation in your app.<\/p>\n<figure><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/assets.hongkiat.com\/uploads\/ios-development-guide-part2\/utilities.jpg\" alt=\"Utilities in Xcode\" width=\"600\" height=\"514\"><\/figure>\n<p>Before we add the icons, we need another menu called the <strong>Utilities<\/strong>. The Utilities pane is enabled by default, but you can also <strong>enable it by selecting View &gt; Utilities &gt; Show Utilities<\/strong> on the top menu bar of the software.<\/p>\n<figure><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/assets.hongkiat.com\/uploads\/ios-development-guide-part2\/tab-bar-item.jpg\" alt=\"Tab bar item in Xcode\" width=\"600\" height=\"422\"><\/figure>\n<p>Back in the Document Outline, you will notice how the First View and Second View each have their scene box and view controller. <strong>Click on the left arrow of First View Controller \u2013 First<\/strong> to display more elements, and you should see <strong>Tab Bar Item<\/strong>. <strong>Click to select it<\/strong>, and if you can\u2019t see anything, try scrolling to the right in your storyboard viewer. All the edits for the tabs will be done in the <strong>Attributes Inspector<\/strong>, which you can show by <strong>selecting View &gt; Utilities &gt; Show Attributes Inspector<\/strong>.<\/p>\n<figure><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/assets.hongkiat.com\/uploads\/ios-development-guide-part2\/select-image-for-bar-item.jpg\" alt=\"Selecting image for tab bar item in Xcode\" width=\"600\" height=\"293\"><\/figure>\n<p>Now look at the Utilities pane on the right side of the editor, and you will see the <strong>Title<\/strong> and <strong>Image<\/strong> property under the Tab Bar Item. <strong>Click on the down arrow of the Image option<\/strong>, then <strong>select <em>61-brightness.png<\/em><\/strong>. The icon will be assigned to the Tab Bar Item of the First View. You can also <strong>remove the Title<\/strong> of the Tab Bar Item so there will be no text below the icon.<\/p>\n<p>For the Second View, return to the Document Outline and <strong>click on the down arrow of Second View Controller \u2013 Second<\/strong> to show the Tab Bar Item \u2013 Second. <strong>Click on \u201cTab Bar Item \u2013 Second\u201d<\/strong> and look at the Utilities pane on the right side of the editor for the <strong>Title<\/strong> and <strong>Image<\/strong> property under the Tab Bar Item. <strong>Click on the down arrow<\/strong> of the Image option, then <strong>select <em>07-map-marker.png<\/em><\/strong>. The icon will be assigned to the Tab Bar Item of the Second View. <strong>Remove the Title<\/strong> of the Tab Bar Item.<\/p>\n<h2>Designing Views with Objects<\/h2>\n<p>We\u2019ve finished importing and setting the images. Now, let\u2019s move on to designing the views. We will design the First View first, then copy all elements from the First View and paste them into the Second View, making some additional changes for the Second View later.<\/p>\n<figure><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/assets.hongkiat.com\/uploads\/ios-development-guide-part2\/change-text-header.jpg\" alt=\"Changing text header in Xcode\" width=\"600\" height=\"343\"><\/figure>\n<p>For each default view, we are given a basic <strong>text header<\/strong> and <strong>description object<\/strong>. <strong>Double-click on the \u201cFirst View\u201d text of the First View Controller in the visual editor<\/strong> and <strong>change it to \u201cTemp Converter\u201d<\/strong>. <strong>Repeat the process for the Second View Controller<\/strong> but <strong>change the name to \u201cDistance Converter\u201d<\/strong>. You can select the text and use the Attributes Inspector in the Utilities pane to change the font, color, size, etc.<\/p>\n<figure><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/assets.hongkiat.com\/uploads\/ios-development-guide-part2\/change-description-text.jpg\" alt=\"Changing description text in Xcode\" width=\"600\" height=\"343\"><\/figure>\n<p>For the description object under the text header of the First View Controller, you <strong>can double-click on the description text<\/strong> and <strong>provide a basic description of what we\u2019ll be doing<\/strong> in each view, such as \u201c<em>Enter the value below to convert Fahrenheit into Celsius<\/em>\u201c. You can <strong>repeat the process to give a basic description for the description object of the Second View Controller<\/strong>, but change the description to \u201c<em>Enter the value below to convert Miles into Kilometers and Astronomical Units<\/em>\u201c.<\/p>\n<figure><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/assets.hongkiat.com\/uploads\/ios-development-guide-part2\/add-text-field.jpg\" alt=\"Adding text field in Xcode\" width=\"600\" height=\"513\"><\/figure>\n<p>Now we need to create a text field for the value input. In the bottom part of the Utilities pane on the right side of the software, you should see the Objects library, which can also be enabled by <strong>selecting View &gt; Utilities &gt; Show Object Library<\/strong>. In its drop-down menu, <strong>choose Controls<\/strong> and <strong>select a Text Field<\/strong>, then <strong>drag it into the First View Controller<\/strong>.<\/p>\n<figure><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/assets.hongkiat.com\/uploads\/ios-development-guide-part2\/add-placeholder.jpg\" alt=\"Adding placeholder text in Xcode\" width=\"600\" height=\"513\"><\/figure>\n<p><strong>Move the text field to center it<\/strong> and <strong>resize the box to your preferred size<\/strong>. In the Attributes Inspector in the Utilities pane, you can also change the text color of the input field. Next, <strong>add the text \u201cEnter temperature\u2026\u201d into the Placeholder field (not the Text field)<\/strong>.<\/p>\n<figure><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/assets.hongkiat.com\/uploads\/ios-development-guide-part2\/extra-settings.jpg\" alt=\"Extra settings for text field in Xcode\" width=\"600\" height=\"343\"><\/figure>\n<p>Now let\u2019s do some extra settings to make the app more user-friendly. <strong>In the Utilities pane, find the property \u201cClear Button\u201d<\/strong>, then <strong>change it from \u201cNever appears\u201d to \u201cAppears while editing\u201d<\/strong>. This allows you to delete the entire entry at once without repeatedly tapping the <span class=\"key\">x<\/span> button.<\/p>\n<p>Next, <strong>in the pane, find the \u201cKeyboard\u201d property<\/strong> with a drop-down menu. <strong>Change this from \u201cDefault\u201d to \u201cNumber Pad\u201d<\/strong> so the input will be limited to only numbers.<\/p>\n<figure><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/assets.hongkiat.com\/uploads\/ios-development-guide-part2\/add-button.jpg\" alt=\"Adding button in Xcode\" width=\"600\" height=\"513\"><\/figure>\n<p>Next, we will create a button to convert the value. <strong>Drag a Round Rect Button<\/strong> from the Object Library located at the bottom of the Utilities pane and <strong>place it below the text field<\/strong>. <strong>Double-click to add the text \u201cConvert!\u201d<\/strong>. Again, spend some time in the Attributes Inspector to customize the style, although it looks fine by default.<\/p>\n<figure><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/assets.hongkiat.com\/uploads\/ios-development-guide-part2\/add-label.jpg\" alt=\"Adding label in Xcode\" width=\"600\" height=\"513\"><\/figure>\n<p>We just need to <strong>drag the Label object from the Object Library into the First View Controller<\/strong> to handle output text from the conversions. When you drag the label into the view, by default it\u2019s given some static text, such as \u201cLabel\u201d. You should <strong>delete the text<\/strong> so nothing will be displayed when the app launches. <strong>Resize the box to make it wider<\/strong> and position it below the Convert button.<\/p>\n<figure><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/assets.hongkiat.com\/uploads\/ios-development-guide-part2\/improved-design.jpg\" alt=\"Improved design in Xcode\" width=\"600\" height=\"343\"><\/figure>\n<p>Before we move to the Second View Controller, you can <strong>improve the design of the First View Controller<\/strong>. It\u2019s recommended to enhance the design now so later, when we duplicate the elements of the First View Controller to the Second View Controller, we don\u2019t need to redesign the Second View Controller again.<\/p>\n<p>Now let\u2019s do the same process for the Second View Controller. We can save time by copying everything from the First View, but we also need to change certain things to match the function of the Second View Controller.<\/p>\n<figure><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/assets.hongkiat.com\/uploads\/ios-development-guide-part2\/select-all-elements.jpg\" alt=\"Selecting all elements in Xcode\" width=\"600\" height=\"513\"><\/figure>\n<p>Click on the \u201cView\u201d of the Second View Controller in your Document Outline, and <strong>drag to select all items and delete them<\/strong>. This should only remove a text header and description object so that the second view is completely empty. Now <strong>select all the items in the First View<\/strong> and press cmd+c\/cmd+v to copy\/paste them into the empty Second View. Below are the changes required for the Second View:<\/p>\n<ul>\n<li>Text Header \u2013 Change to \u201cDistance Converter\u201d.<\/li>\n<li>Text Field \u2013 Placeholder reads \u201cEnter distance\u2026\u201d and set Keyboard property to \u201cNumber Pad\u201d.<\/li>\n<li>Labels \u2013 Add one more Label below the existing Label. The top Label will display the Kilometers value, while the bottom Label will display the Astronomical Units value.<\/li>\n<\/ul>\n<figure><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/assets.hongkiat.com\/uploads\/ios-development-guide-part2\/second-view-controller-design.jpg\" alt=\"Second View Controller design in Xcode\" width=\"600\" height=\"513\"><\/figure>\n<p>This is what you will achieve in the end. You can notice that the outcome of the Second View is almost identical to the First View.<\/p>\n<h2>Programming In First View<\/h2>\n<p>Enough graphics for now, let\u2019s move into some programming! We can start by building the backend functionality for our simpler first view. <strong>Select <em>FirstViewController.h<\/em><\/strong> from your Project Navigator.<\/p>\n<figure><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/assets.hongkiat.com\/uploads\/ios-development-guide-part2\/firstviewcontroller-h.jpg\" alt=\"FirstViewController.h design in Xcode\" width=\"600\" height=\"295\"><\/figure>\n<p>We need to update the code to give instance names for each of the functions and properties we\u2019re using. First of all, you will see the following code in <em>FirstViewController.h<\/em>:<\/p>\n<pre>\r\n#import &lt;UIKit\/UIKit.h&gt;\r\n\r\n@interface FirstViewController : UIViewController\r\n\r\n@end\r\n<\/pre>\n<p>Now <strong>replace the code above with the code below<\/strong>. The <strong>@interface<\/strong> keyword is creating a subclass of UIViewController, which is the default view in any iOS app.<\/p>\n<pre>\r\n#import &lt;UIKit\/UIKit.h&gt;\r\n\r\n@interface FirstViewController : UIViewController {\r\n    UITextField *tempTextBox;\r\n    UILabel *calcResult;\r\n}\r\n@property (nonatomic, retain) IBOutlet UILabel *calcResult;\r\n@property (nonatomic, retain) IBOutlet UITextField *tempTextBox;\r\n- (IBAction)degreeConvert:(id)sender;\r\n- (IBAction)backgroundTouchedHideKeyboard:(id)sender;\r\n@end\r\n<\/pre>\n<p>We need to declare <strong>IBOutlets (Interface Builder Outlets)<\/strong> for each of the elements in our app. This is what <strong>@property<\/strong> is creating \u2013 a new outlet for Xcode to connect to the interface. I also defined two actions which, in simple terms, are blocks of code that execute whenever they\u2019re called.<\/p>\n<p>About <strong>degreeConvert<\/strong>, it will take the value in our text field and perform conversions from Fahrenheit to Celsius. Similarly, <strong>backgroundTouchedHideKeyboard<\/strong> is a small action I\u2019ll be adding to hide the keyboard when the user touches any part of the background.<\/p>\n<figure><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/assets.hongkiat.com\/uploads\/ios-development-guide-part2\/firstviewcontroller-m.jpg\" alt=\"FirstViewController.m design in Xcode\" width=\"600\" height=\"473\"><\/figure>\n<p>Now we get into the differences between <strong>.h<\/strong> and <strong>.m<\/strong> files. We\u2019ve declared all of these functions and variables, but they don\u2019t do anything or connect to anything right now. We need to <strong>implement the functionality into our <em>FirstViewController.m<\/em><\/strong>. <strong>Save any changes<\/strong> and <strong>click to open <em>FirstViewController.m<\/em><\/strong> in Project Navigator. We need to create a synthesis to access elements in the First View header. This is performed with <strong>@synthesize<\/strong> so now our actions can manipulate the different objects on-screen.<\/p>\n<p><strong>Add the <code>@synthesize tempTextBox, calcResult;<\/code> into <em>FirstViewController.m<\/em><\/strong> so the first few lines will look like this:<\/p>\n<pre>\r\n#import \"FirstViewController.h\"\r\n\r\n@implementation FirstViewController\r\n@synthesize tempTextBox, calcResult;\r\n<\/pre>\n<p>This is declared for the single text field and results label, respectively. To go further, let\u2019s look at the two functions I\u2019ve pre-written. If you are still new to Objective-C syntax, it may seem a bit confusing. But you\u2019ll get used to the structures over time. <strong>Paste the code below into the file<\/strong>.<\/p>\n<pre>\r\n- (void)degreeConvert:(id)sender \r\n{\r\n    double fahren = [tempTextBox.text doubleValue];\r\n    double celsius = (fahren - 32) \/ 1.8;\r\n\r\n    [tempTextBox resignFirstResponder];\r\n\r\n    NSString *convertResult = [[NSString alloc] initWithFormat: @\"Celsius: %f\", celsius];\r\n    calcResult.text = convertResult;\r\n}\r\n\r\n- (void)backgroundTouchedHideKeyboard:(id)sender\r\n{\r\n    [tempTextBox resignFirstResponder];\r\n}\r\n<\/pre>\n<p>First, we have <strong>degreeConvert<\/strong>, which takes no parameters and returns void. This is the method called when a user presses the convert button in the first view. A variable <strong>fahren<\/strong> is set to pull the value from whatever the user has entered. We can then calculate another variable, <strong>celsius<\/strong>, with basic math.<\/p>\n<p>Now <code>[tempTextBox resignFirstResponder]<\/code> is actually calling a method <strong>resignFirstResponder<\/strong> on our keyboard. This code is also seen in the second function, <strong>backgroundTouchedHideKeyboard<\/strong>. Basically, it hides the keyboard and deselects the text field after the user either touches the background or hits the convert button.<\/p>\n<p>The rest of our degreeConvert function creates a new string (NSString) to store the Celsius conversion and, using dot syntax, adds this to our label field. If you have any familiarity with C-based programming (Java, PHP, C#\/C++, Perl), some of these terms should be familiar.<\/p>\n<p>Now, <strong>search for the code below<\/strong>:<\/p>\n<pre>\r\n- (void)viewDidUnload\r\n{\r\n    [super viewDidUnload];\r\n\r\n    \/\/ Release any retained subviews of the main view.\r\n    \/\/ e.g. self.myOutlet = nil;\r\n}\r\n<\/pre>\n<p><strong>Replace the code above with the code below<\/strong>:<\/p>\n<pre>\r\n- (void)viewDidUnload\r\n{\r\n    [super viewDidUnload];\r\n\r\n    \/\/ Release any retained subviews of the main view.\r\n    \/\/ e.g. self.myOutlet = nil;\r\n    self.tempTextBox = nil;\r\n    self.calcResult = nil;\r\n}\r\n<\/pre>\n<p>At the bottom of our <strong><em>FirstViewController.m<\/em><\/strong>, I\u2019ve done some <strong>garbage collection<\/strong> for the variables we synthesized. We should release all the different subviews from memory, including our text field and output label. <a rel=\"nofollow noopener\" target=\"_blank\" href=\"https:\/\/clang.llvm.org\/docs\/AutomaticReferenceCounting.html\">Automatic Reference Counting<\/a> (ARC) will automatically deallocate variables from memory, which will save a lot of stress on iOS projects.<\/p>\n<h2>Connecting Actions And Outlets<\/h2>\n<p>This is the final step for the First View where we will <strong>connect our front-end elements with back-end code<\/strong>! When building iOS apps, there are three major segments to completion: <strong>adding the physical UI elements<\/strong>, <strong>writing the program code<\/strong>, and finally <strong>connecting the two together<\/strong>. This segment will wire all our First View\u2019s components to make them run and work perfectly!<\/p>\n<p><strong>Save both your <em>FirstViewController.h<\/em> and <em>FirstViewController.m<\/em><\/strong> to ensure everything is updated. Then, <strong>click back onto the storyboard<\/strong> and <strong>look at the Document Outline<\/strong>. There, you\u2019ll notice an orange orb named <strong>First View Controller \u2013 First<\/strong>.<\/p>\n<figure><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/assets.hongkiat.com\/uploads\/ios-development-guide-part2\/connect-temptextbox.jpg\" alt=\"Connecting tempTextBox in Xcode\" width=\"600\" height=\"364\"><\/figure>\n<p><strong>Click on the orb to select it<\/strong>, and a blue outline should appear on your First View scene. Now <strong>press <span class=\"key\">Ctrl<\/span><\/strong> and <strong>click the First View Controller \u2013 First to drag onto the text field<\/strong>, then <strong>release it<\/strong>.<\/p>\n<figure><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/assets.hongkiat.com\/uploads\/ios-development-guide-part2\/select-temptextbox.jpg\" alt=\"Selecting tempTextBox in Xcode\" width=\"600\" height=\"364\"><\/figure>\n<p>After the action, a list of <strong>Outlets<\/strong> will come up. <strong>Select \u201ctempTextBox\u201d from the list<\/strong>. If the connection is successful, the text field will <strong>flash<\/strong>.<\/p>\n<figure><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/assets.hongkiat.com\/uploads\/ios-development-guide-part2\/connect-label.jpg\" alt=\"Connecting label in Xcode\" width=\"600\" height=\"364\"><\/figure>\n<p>Now <strong>press <span class=\"key\">Ctrl<\/span> and click the First View Controller \u2013 First again to drag onto the Label field<\/strong> and <strong>select \u201ccalcResult\u201d<\/strong>. Both our outlets are now connected to these variables, and we just need to connect the actions.<\/p>\n<figure><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/assets.hongkiat.com\/uploads\/ios-development-guide-part2\/change-custom-class.jpg\" alt=\"Changing custom class in Xcode\" width=\"600\" height=\"293\"><\/figure>\n<p><strong>Click on the right arrow of the First View Controller \u2013 First<\/strong> and you will see a component named <strong>View<\/strong> \u2013 <strong>click to select it<\/strong>. <strong>Open your Identity inspector<\/strong> in the Utilities pane, which you can also enable by going to the top menu bar of the software, and selecting <strong>View &gt; Utilities &gt; Show Identity Inspector<\/strong>. Under <strong>Custom Class, enter \u201cUIControl\u201d<\/strong> or select it from the dropdown menu.<\/p>\n<p>In order for the keyboard to recognize the background as a tappable object, it must be converted into a control. Now, in the Utilities pane, <strong>activate the Connections inspector by going to the top menu bar of the software and selecting View &gt; Utilities &gt; Show Connections Inspector<\/strong>.<\/p>\n<figure><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/assets.hongkiat.com\/uploads\/ios-development-guide-part2\/connect-page-event.jpg\" alt=\"Connecting page event in Xcode\" width=\"600\" height=\"361\"><\/figure>\n<p>This is how we connect a page event (swipe, tap, hold, etc.) to a single function call. Look through the list of events until you find <strong>Touch Down<\/strong>. <strong>Click the small circle located at the right side of the Touch Down event<\/strong>, then <strong>drag and drop it onto the First View Controller<\/strong>. You\u2019ll be given two actions to select from \u2013 <strong>choose backgroundTouchedHideKeyboard<\/strong> and you\u2019ll get a confirmation flash.<\/p>\n<figure><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/assets.hongkiat.com\/uploads\/ios-development-guide-part2\/connect-button-event.jpg\" alt=\"Connecting button event in Xcode\" width=\"600\" height=\"297\"><\/figure>\n<p>Finally, <strong>click to select the Convert button<\/strong> and make sure it has a <strong>blue highlight<\/strong>, similar to the screenshot above but <strong>without selecting the whole View Control<\/strong>. In the <strong>Connections Inspector<\/strong>, <strong>drag the Touch Up Inside\u2019s small circle and drop it onto the First View Controller again<\/strong>. Choose the function named <strong>degreeConvert<\/strong>, which will only trigger when the user touches the button and releases it within the set boundaries.<\/p>\n<h2>Porting Code Over To Second View<\/h2>\n<p>Now this may be a good time to save your work and compile\/build the application so far. If everything is running smoothly, you should be able to enter some values into the text field and hit convert to see the result in Celsius! If you\u2019re getting any errors, <strong>try downloading the demo project<\/strong> in the last section of this article to compare the differences and fix the errors.<\/p>\n<p>I\u2019ll assume you\u2019ve already created the layout for the Second View in the earlier section. Instead of outputting one conversion (Fahrenheit &gt; Celsius), our Second View will <strong>output two values<\/strong> (<strong>Miles &gt; Kilometers<\/strong> and <strong>Miles &gt; Astronomical Units<\/strong>). So all we need to do is <strong>migrate the Objective-C code from the First View<\/strong> and <strong>reorganize everything to work properly for our Second View<\/strong>, then finish up by connecting the storyboard to our new actions and outlets.<\/p>\n<p>We should start with the header code and move into implementation. Below I\u2019ve added the full code from my SecondViewController.h file. It\u2019s basically a clone of the First View Controller\u2019s header, but with an additional property linked to the second UILabel element.<\/p>\n<p>Again you need to <strong>search for the following code in <em>SecondViewController.h<\/em><\/strong>:<\/p>\n<pre>\r\n#import &lt;UIKit\/UIKit.h&gt;\r\n\r\n@interface SecondViewController : UIViewController\r\n\r\n@end\r\n<\/pre>\n<p><strong>Replace the code above with the code below<\/strong>:<\/p>\n<pre>\r\n#import &lt;UIKit\/UIKit.h&gt;\r\n\r\n@interface SecondViewController : UIViewController {\r\n    UITextField *distTextBox;\r\n    UILabel *distResult;\r\n    UILabel *auResult;\r\n}\r\n@property (nonatomic, retain) IBOutlet UILabel *distResult;\r\n@property (nonatomic, retain) IBOutlet UILabel *auResult;\r\n@property (nonatomic, retain) IBOutlet UITextField *distTextBox;\r\n- (IBAction)distanceConvert:(id)sender;\r\n- (IBAction)backgroundTouchedHideKeyboard:(id)sender;\r\n@end\r\n<\/pre>\n<p>You can notice I\u2019ve <strong>changed all the instance names for the actions and outlets<\/strong>. <strong>distTextBox<\/strong> will now hold our text input for distance. <strong>distResult<\/strong> is the first distance result label (kilometers) and <strong>auResult<\/strong> will hold our second conversion label. <strong>distanceConvert<\/strong> is the new action we call to convert the numeric value, and backgroundTouchedHideKeyboard remains the same.<\/p>\n<p>As before, we\u2019re using the <a rel=\"nofollow noopener\" target=\"_blank\" href=\"https:\/\/en.wikipedia.org\/wiki\/Model%E2%80%93view%E2%80%93controller\">MVC hierarchy<\/a> to separate the app functions (implementation) from the controller between storyboard objects. If your SecondViewController.h looks the same as mine above, <strong>save changes<\/strong> and <strong>select SecondViewController.m<\/strong>. I will again break up my code into two parts.<\/p>\n<p>The code below is from the top portion of my SecondViewController.m. This contains the <strong>@synthesize<\/strong> statement to create setters and getters for each instance variable. I know this concept of synthesizing instance variables can be very confusing initially. I recommend this <a rel=\"nofollow noopener\" target=\"_blank\" href=\"https:\/\/stackoverflow.com\/questions\/3266467\/what-exactly-does-synthesize-do\">StackOverflow thread<\/a> which may help to clear things up.<\/p>\n<p>Now, <strong>look for the code below in <em>SecondViewController.m<\/em><\/strong>:<\/p>\n<pre>\r\n#import \"SecondViewController.h\"\r\n\r\n@implementation SecondViewController\r\n<\/pre>\n<p><strong>Replace the code above with the code below<\/strong>:<\/p>\n<pre>\r\n#import \"SecondViewController.h\"\r\n\r\n@implementation SecondViewController\r\n@synthesize distResult, auResult, distTextBox;\r\n\r\n- (void)distanceConvert:(id)sender\r\n{\r\n    double miles = [distTextBox.text doubleValue];\r\n    double km = miles * 1.61; \/\/ multiply miles by ~1.609 kilometers\r\n    double au = miles \/ 92956000; \/\/ divide miles by 92,956,000AU\r\n\r\n    [distTextBox resignFirstResponder];\r\n\r\n    NSString *kiloResult = [[NSString alloc] initWithFormat: @\"Kilometers: %f\", km];\r\n    NSString *ausResult = [[NSString alloc] initWithFormat: @\"AUs: %f\", au];\r\n    distResult.text = kiloResult;\r\n    auResult.text = ausResult;\r\n}\r\n\r\n- (void)backgroundTouchedHideKeyboard:(id)sender\r\n{\r\n    [distTextBox resignFirstResponder];\r\n}\r\n<\/pre>\n<p>The new action <strong>distanceConvert<\/strong> will be called once the user taps the Convert button. Variable <strong>miles<\/strong> will pull the number from distTextBox while <strong>km<\/strong> and <strong>au<\/strong> perform some basic mathematical conversions to get their values. Afterwards, using two lines, we allocate memory for two NSString objects holding the Kilometer and AU output info. Using dot syntax, we call upon the <strong>.text property<\/strong> to change UILabel text.<\/p>\n<p>Now, <strong>search for the code<\/strong> below:<\/p>\n<pre>\r\n- (void)viewDidUnload\r\n{\r\n    [super viewDidUnload];\r\n\r\n    \/\/ Release any retained subviews of the main view.\r\n    \/\/ e.g. self.myOutlet = nil;\r\n}\r\n<\/pre>\n<p><strong>Replace the code above with the code below<\/strong>:<\/p>\n<pre>\r\n- (void)viewDidUnload\r\n{\r\n    [super viewDidUnload];\r\n\r\n    \/\/ Release any retained subviews of the main view.\r\n    \/\/ e.g. self.myOutlet = nil;\r\n    self.distResult = nil;\r\n    self.auResult = nil;\r\n    self.distTextBox = nil;\r\n}\r\n<\/pre>\n<p>And now the final bit of code found at the very end of SecondViewController.m. <strong>viewDidUnload<\/strong> is called after our view is finished compiling and displaying. We set the three properties synthesized earlier to <strong>nil<\/strong> (null in Objective-C) and release their instance from memory. The app is almost complete after we finish connecting the storyboard to outlets and actions.<\/p>\n<h2>Second View Connections<\/h2>\n<p>The process of building views is basically a repetition of step 5, with a few extra steps. You can treat this as an exercise to strengthen your memory on connecting the storyboard to outlets and actions, as they can often be confusing.<\/p>\n<p>Again, <strong>save both your <em>SecondViewController.h<\/em> and <em>SecondViewController.m<\/em><\/strong> to make sure everything is updated. Then, <strong>click back onto the storyboard<\/strong> and <strong>look at the Document Outline<\/strong>. There, you\u2019ll notice an orange orb named <strong>Second View Controller \u2013 Second<\/strong>.<\/p>\n<figure><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/assets.hongkiat.com\/uploads\/ios-development-guide-part2\/connect-distTextbox.jpg\" alt=\"Connecting distTextBox in Xcode\" width=\"600\" height=\"433\"><\/figure>\n<p><strong>Click on the orb to select it<\/strong>, and a blue outline should appear on your Second View scene. Now <strong>press <span class=\"key\">Ctrl<\/span><\/strong> and <strong>click the Second View Controller \u2013 Second to drag onto the text field<\/strong>, then <strong>release it<\/strong>.<\/p>\n<p>After the action, a list of <strong>Outlets<\/strong> will come up. <strong>Select \u201cdistTextBox\u201d from the list<\/strong>. If the connection is successful, the text field will <strong>flash<\/strong>.<\/p>\n<figure><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/assets.hongkiat.com\/uploads\/ios-development-guide-part2\/connect-distresult.jpg\" alt=\"Connecting distResult in Xcode\" width=\"600\" height=\"473\"><\/figure>\n<p>Now <strong>press <span class=\"key\">Ctrl<\/span> and click the Second View Controller \u2013 Second again to drag onto the Label field<\/strong> and <strong>select \u201cdistResult\u201d<\/strong>. <strong>Repeat the process for the second Label<\/strong> located below the first Label, but <strong>choose \u201cauResult\u201d<\/strong> for it. Both our outlets are now connected to these variables, and we just need to connect the actions.<\/p>\n<figure><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/assets.hongkiat.com\/uploads\/ios-development-guide-part2\/second-view_change-custom-class.jpg\" alt=\"Changing custom class in Xcode\" width=\"600\" height=\"433\"><\/figure>\n<p><strong>Click on the right arrow of the Second View Controller \u2013 Second<\/strong> and you will see a component named <strong>View<\/strong> \u2013 <strong>click to select it<\/strong>. <strong>Open your Identity inspector<\/strong> in the Utilities pane, which you can also enable by going to the top menu bar of the software and selecting <strong>View &gt; Utilities &gt; Show Identity Inspector<\/strong>. Under <strong>Custom Class, enter \u201cUIControl\u201d<\/strong> or select it from the dropdown menu.<\/p>\n<p>In order for the keyboard to recognize the background as a tappable object, it must be converted into a control. Now, in the Utilities pane, activate the <strong>Connections inspector by going to the top menu bar of the software and selecting View &gt; Utilities &gt; Show Connections Inspector<\/strong>.<\/p>\n<figure><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/assets.hongkiat.com\/uploads\/ios-development-guide-part2\/second-view_connect-page-event.jpg\" alt=\"Connecting page event in Xcode\" width=\"600\" height=\"433\"><\/figure>\n<p>This is how we connect a page event (swipe, tap, hold, etc.) to a single function call. Look through the list of events until you find <strong>Touch Down<\/strong>. <strong>Click the small circle located at the right side of the Touch Down event<\/strong>, then <strong>drag and drop it onto the Second View Controller<\/strong>. You\u2019ll be given two actions to select from \u2013 <strong>choose backgroundTouchedHideKeyboard<\/strong> and you\u2019ll get a confirmation flash.<\/p>\n<figure><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/assets.hongkiat.com\/uploads\/ios-development-guide-part2\/second-view_connect-button-event.jpg\" alt=\"Connecting button event in Xcode\" width=\"600\" height=\"433\"><\/figure>\n<p>Finally, <strong>click to select the Convert button<\/strong> and make sure it has a <strong>blue highlight<\/strong>, similar to the screenshot above but <strong>without selecting the whole View Control<\/strong>. In the <strong>Connections Inspector<\/strong>, <strong>drag the Touch Up Inside\u2019s small circle and drop it onto the Second View Controller again<\/strong>. Choose the function named <strong>distanceConvert<\/strong>, which will only trigger when the user touches the button and releases it within the set boundaries.<\/p>\n<p>Build and Run to see if your app compiles successfully. If there are no errors, everything should work properly. You could now spend time improving the text and layout, or maybe adding a custom logo PNG.<\/p>\n<p>Thanks for following the tutorial and congrats, you\u2019ve just made your first working iPhone app!<\/p>\n<h2>Download Xcode Project<\/h2>\n<p>Can\u2019t achieve a certain step? Here is the result file for you to test and compare the differences.<\/p>\n<ul>\n<li><a rel=\"nofollow noopener\" target=\"_blank\" href=\"https:\/\/assets.hongkiat.com\/uploads\/ios-development-guide-part2\/Converter-iOS-App-Source.zip\">iPhone Application Tutorial Project File<\/a><\/li>\n<\/ul>\n<h2>Final Words<\/h2>\n<p>In closing, it would be helpful to review the key points in this tutorial. We <strong>started a new Xcode iPhone app project with a tabbed navigation<\/strong>. This included <strong>two UIViews to which we added a text field, button, and labels<\/strong>. We then <strong>wrote some Objective-C code for defining Instance Variables (ivars) and Actions (functions)<\/strong> to process the conversions.<\/p>\n<p>After all this, we finally <strong>connected Objects for each Instance Variable<\/strong>. This <strong>allowed the Objective-C backend implementation code to target an ID such as tempTextBox<\/strong> and <strong>tie it to a storyboard object<\/strong>.<\/p>\n<p>Hopefully, you\u2019ve learned many of the keywords and techniques for using Xcode. You most likely won\u2019t be an expert at building iOS apps after this tutorial. In fact, you may still be deeply confused about a lot of these topics! <strong>iOS programming requires practice<\/strong>, so <strong>don\u2019t feel discouraged<\/strong> if you cannot understand everything right away. <strong>Try downloading the demo project file<\/strong> I\u2019ve provided and look through it to familiarize yourself with this tutorial and Xcode projects in general. One last tip: <strong>never give up!<\/strong><\/p>","protected":false},"excerpt":{"rendered":"<p>In the first part of our iOS tutorial, we took you through an introduction to iPhone app development. We explored Xcode 4 and covered a basic tutorial on building an iPhone app. This beginner tutorial was designed for anyone interested in learning how to program iOS apps. Today, we\u2019ll delve into the second segment of&hellip;<\/p>\n","protected":false},"author":18,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"_jetpack_memberships_contains_paid_content":false,"footnotes":""},"categories":[3392],"tags":[76,1846,1722,3933],"topic":[4520,4521],"class_list":["entry-content","is-maxi"],"acf":[],"yoast_head":"<!-- This site is optimized with the Yoast SEO Premium plugin v22.8 (Yoast SEO v27.7) - https:\/\/yoast.com\/product\/yoast-seo-premium-wordpress\/ -->\n<title>iOS Development Guide: Creating Your First App (Part II) - Hongkiat<\/title>\n<meta name=\"description\" content=\"In the first part of our iOS tutorial, we took you through an introduction to iPhone app development. We explored Xcode 4 and covered a basic tutorial on\" \/>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/www.hongkiat.com\/blog\/ios-development-guide-part2-your-first-app\/\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"iOS Development Guide: Creating Your First App (Part II)\" \/>\n<meta property=\"og:description\" content=\"In the first part of our iOS tutorial, we took you through an introduction to iPhone app development. We explored Xcode 4 and covered a basic tutorial on\" \/>\n<meta property=\"og:url\" content=\"https:\/\/www.hongkiat.com\/blog\/ios-development-guide-part2-your-first-app\/\" \/>\n<meta property=\"og:site_name\" content=\"Hongkiat\" \/>\n<meta property=\"article:publisher\" content=\"https:\/\/www.facebook.com\/hongkiatcom\" \/>\n<meta property=\"article:published_time\" content=\"2011-11-08T13:03:07+00:00\" \/>\n<meta property=\"article:modified_time\" content=\"2025-04-03T16:43:45+00:00\" \/>\n<meta property=\"og:image\" content=\"https:\/\/assets.hongkiat.com\/uploads\/ios-development-guide-part2\/xcode.jpg\" \/>\n<meta name=\"author\" content=\"Jake Rocheleau\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:creator\" content=\"@hongkiat\" \/>\n<meta name=\"twitter:site\" content=\"@hongkiat\" \/>\n<meta name=\"twitter:label1\" content=\"Written by\" \/>\n\t<meta name=\"twitter:data1\" content=\"Jake Rocheleau\" \/>\n\t<meta name=\"twitter:label2\" content=\"Est. reading time\" \/>\n\t<meta name=\"twitter:data2\" content=\"25 minutes\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\\\/\\\/schema.org\",\"@graph\":[{\"@type\":\"Article\",\"@id\":\"https:\\\/\\\/www.hongkiat.com\\\/blog\\\/ios-development-guide-part2-your-first-app\\\/#article\",\"isPartOf\":{\"@id\":\"https:\\\/\\\/www.hongkiat.com\\\/blog\\\/ios-development-guide-part2-your-first-app\\\/\"},\"author\":{\"name\":\"Jake Rocheleau\",\"@id\":\"https:\\\/\\\/www.hongkiat.com\\\/blog\\\/#\\\/schema\\\/person\\\/966b2daea15283b4145e71aa98a82c2a\"},\"headline\":\"iOS Development Guide: Creating Your First App (Part II)\",\"datePublished\":\"2011-11-08T13:03:07+00:00\",\"dateModified\":\"2025-04-03T16:43:45+00:00\",\"mainEntityOfPage\":{\"@id\":\"https:\\\/\\\/www.hongkiat.com\\\/blog\\\/ios-development-guide-part2-your-first-app\\\/\"},\"wordCount\":4252,\"commentCount\":23,\"publisher\":{\"@id\":\"https:\\\/\\\/www.hongkiat.com\\\/blog\\\/#organization\"},\"image\":{\"@id\":\"https:\\\/\\\/www.hongkiat.com\\\/blog\\\/ios-development-guide-part2-your-first-app\\\/#primaryimage\"},\"thumbnailUrl\":\"https:\\\/\\\/assets.hongkiat.com\\\/uploads\\\/ios-development-guide-part2\\\/xcode.jpg\",\"keywords\":[\"Apple\",\"iOS\",\"iOS Apps\",\"macOS\"],\"articleSection\":[\"Coding\"],\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"CommentAction\",\"name\":\"Comment\",\"target\":[\"https:\\\/\\\/www.hongkiat.com\\\/blog\\\/ios-development-guide-part2-your-first-app\\\/#respond\"]}]},{\"@type\":\"WebPage\",\"@id\":\"https:\\\/\\\/www.hongkiat.com\\\/blog\\\/ios-development-guide-part2-your-first-app\\\/\",\"url\":\"https:\\\/\\\/www.hongkiat.com\\\/blog\\\/ios-development-guide-part2-your-first-app\\\/\",\"name\":\"iOS Development Guide: Creating Your First App (Part II) - Hongkiat\",\"isPartOf\":{\"@id\":\"https:\\\/\\\/www.hongkiat.com\\\/blog\\\/#website\"},\"primaryImageOfPage\":{\"@id\":\"https:\\\/\\\/www.hongkiat.com\\\/blog\\\/ios-development-guide-part2-your-first-app\\\/#primaryimage\"},\"image\":{\"@id\":\"https:\\\/\\\/www.hongkiat.com\\\/blog\\\/ios-development-guide-part2-your-first-app\\\/#primaryimage\"},\"thumbnailUrl\":\"https:\\\/\\\/assets.hongkiat.com\\\/uploads\\\/ios-development-guide-part2\\\/xcode.jpg\",\"datePublished\":\"2011-11-08T13:03:07+00:00\",\"dateModified\":\"2025-04-03T16:43:45+00:00\",\"description\":\"In the first part of our iOS tutorial, we took you through an introduction to iPhone app development. We explored Xcode 4 and covered a basic tutorial on\",\"breadcrumb\":{\"@id\":\"https:\\\/\\\/www.hongkiat.com\\\/blog\\\/ios-development-guide-part2-your-first-app\\\/#breadcrumb\"},\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\\\/\\\/www.hongkiat.com\\\/blog\\\/ios-development-guide-part2-your-first-app\\\/\"]}]},{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\\\/\\\/www.hongkiat.com\\\/blog\\\/ios-development-guide-part2-your-first-app\\\/#primaryimage\",\"url\":\"https:\\\/\\\/assets.hongkiat.com\\\/uploads\\\/ios-development-guide-part2\\\/xcode.jpg\",\"contentUrl\":\"https:\\\/\\\/assets.hongkiat.com\\\/uploads\\\/ios-development-guide-part2\\\/xcode.jpg\"},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\\\/\\\/www.hongkiat.com\\\/blog\\\/ios-development-guide-part2-your-first-app\\\/#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Home\",\"item\":\"https:\\\/\\\/www.hongkiat.com\\\/blog\\\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"iOS Development Guide: Creating Your First App (Part II)\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\\\/\\\/www.hongkiat.com\\\/blog\\\/#website\",\"url\":\"https:\\\/\\\/www.hongkiat.com\\\/blog\\\/\",\"name\":\"Hongkiat\",\"description\":\"Tech and Design Tips\",\"publisher\":{\"@id\":\"https:\\\/\\\/www.hongkiat.com\\\/blog\\\/#organization\"},\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\\\/\\\/www.hongkiat.com\\\/blog\\\/?s={search_term_string}\"},\"query-input\":{\"@type\":\"PropertyValueSpecification\",\"valueRequired\":true,\"valueName\":\"search_term_string\"}}],\"inLanguage\":\"en-US\"},{\"@type\":\"Organization\",\"@id\":\"https:\\\/\\\/www.hongkiat.com\\\/blog\\\/#organization\",\"name\":\"Hongkiat.com\",\"url\":\"https:\\\/\\\/www.hongkiat.com\\\/blog\\\/\",\"logo\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\\\/\\\/www.hongkiat.com\\\/blog\\\/#\\\/schema\\\/logo\\\/image\\\/\",\"url\":\"https:\\\/\\\/www.hongkiat.com\\\/blog\\\/wp-content\\\/uploads\\\/hkdc-logo-rect-yoast.jpg\",\"contentUrl\":\"https:\\\/\\\/www.hongkiat.com\\\/blog\\\/wp-content\\\/uploads\\\/hkdc-logo-rect-yoast.jpg\",\"width\":1200,\"height\":799,\"caption\":\"Hongkiat.com\"},\"image\":{\"@id\":\"https:\\\/\\\/www.hongkiat.com\\\/blog\\\/#\\\/schema\\\/logo\\\/image\\\/\"},\"sameAs\":[\"https:\\\/\\\/www.facebook.com\\\/hongkiatcom\",\"https:\\\/\\\/x.com\\\/hongkiat\",\"https:\\\/\\\/www.pinterest.com\\\/hongkiat\\\/\"]},{\"@type\":\"Person\",\"@id\":\"https:\\\/\\\/www.hongkiat.com\\\/blog\\\/#\\\/schema\\\/person\\\/966b2daea15283b4145e71aa98a82c2a\",\"name\":\"Jake Rocheleau\",\"description\":\"Jake is a writer and designer with over 10 years experience working on the web. He writes about user experience design and cool resources for designers\",\"sameAs\":[\"https:\\\/\\\/www.hongkiat.com\"],\"url\":\"https:\\\/\\\/www.hongkiat.com\\\/blog\\\/author\\\/jake\\\/\"}]}<\/script>\n<!-- \/ Yoast SEO Premium plugin. -->","yoast_head_json":{"title":"iOS Development Guide: Creating Your First App (Part II) - Hongkiat","description":"In the first part of our iOS tutorial, we took you through an introduction to iPhone app development. We explored Xcode 4 and covered a basic tutorial on","robots":{"index":"index","follow":"follow","max-snippet":"max-snippet:-1","max-image-preview":"max-image-preview:large","max-video-preview":"max-video-preview:-1"},"canonical":"https:\/\/www.hongkiat.com\/blog\/ios-development-guide-part2-your-first-app\/","og_locale":"en_US","og_type":"article","og_title":"iOS Development Guide: Creating Your First App (Part II)","og_description":"In the first part of our iOS tutorial, we took you through an introduction to iPhone app development. We explored Xcode 4 and covered a basic tutorial on","og_url":"https:\/\/www.hongkiat.com\/blog\/ios-development-guide-part2-your-first-app\/","og_site_name":"Hongkiat","article_publisher":"https:\/\/www.facebook.com\/hongkiatcom","article_published_time":"2011-11-08T13:03:07+00:00","article_modified_time":"2025-04-03T16:43:45+00:00","og_image":[{"url":"https:\/\/assets.hongkiat.com\/uploads\/ios-development-guide-part2\/xcode.jpg","type":"","width":"","height":""}],"author":"Jake Rocheleau","twitter_card":"summary_large_image","twitter_creator":"@hongkiat","twitter_site":"@hongkiat","twitter_misc":{"Written by":"Jake Rocheleau","Est. reading time":"25 minutes"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"Article","@id":"https:\/\/www.hongkiat.com\/blog\/ios-development-guide-part2-your-first-app\/#article","isPartOf":{"@id":"https:\/\/www.hongkiat.com\/blog\/ios-development-guide-part2-your-first-app\/"},"author":{"name":"Jake Rocheleau","@id":"https:\/\/www.hongkiat.com\/blog\/#\/schema\/person\/966b2daea15283b4145e71aa98a82c2a"},"headline":"iOS Development Guide: Creating Your First App (Part II)","datePublished":"2011-11-08T13:03:07+00:00","dateModified":"2025-04-03T16:43:45+00:00","mainEntityOfPage":{"@id":"https:\/\/www.hongkiat.com\/blog\/ios-development-guide-part2-your-first-app\/"},"wordCount":4252,"commentCount":23,"publisher":{"@id":"https:\/\/www.hongkiat.com\/blog\/#organization"},"image":{"@id":"https:\/\/www.hongkiat.com\/blog\/ios-development-guide-part2-your-first-app\/#primaryimage"},"thumbnailUrl":"https:\/\/assets.hongkiat.com\/uploads\/ios-development-guide-part2\/xcode.jpg","keywords":["Apple","iOS","iOS Apps","macOS"],"articleSection":["Coding"],"inLanguage":"en-US","potentialAction":[{"@type":"CommentAction","name":"Comment","target":["https:\/\/www.hongkiat.com\/blog\/ios-development-guide-part2-your-first-app\/#respond"]}]},{"@type":"WebPage","@id":"https:\/\/www.hongkiat.com\/blog\/ios-development-guide-part2-your-first-app\/","url":"https:\/\/www.hongkiat.com\/blog\/ios-development-guide-part2-your-first-app\/","name":"iOS Development Guide: Creating Your First App (Part II) - Hongkiat","isPartOf":{"@id":"https:\/\/www.hongkiat.com\/blog\/#website"},"primaryImageOfPage":{"@id":"https:\/\/www.hongkiat.com\/blog\/ios-development-guide-part2-your-first-app\/#primaryimage"},"image":{"@id":"https:\/\/www.hongkiat.com\/blog\/ios-development-guide-part2-your-first-app\/#primaryimage"},"thumbnailUrl":"https:\/\/assets.hongkiat.com\/uploads\/ios-development-guide-part2\/xcode.jpg","datePublished":"2011-11-08T13:03:07+00:00","dateModified":"2025-04-03T16:43:45+00:00","description":"In the first part of our iOS tutorial, we took you through an introduction to iPhone app development. We explored Xcode 4 and covered a basic tutorial on","breadcrumb":{"@id":"https:\/\/www.hongkiat.com\/blog\/ios-development-guide-part2-your-first-app\/#breadcrumb"},"inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["https:\/\/www.hongkiat.com\/blog\/ios-development-guide-part2-your-first-app\/"]}]},{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/www.hongkiat.com\/blog\/ios-development-guide-part2-your-first-app\/#primaryimage","url":"https:\/\/assets.hongkiat.com\/uploads\/ios-development-guide-part2\/xcode.jpg","contentUrl":"https:\/\/assets.hongkiat.com\/uploads\/ios-development-guide-part2\/xcode.jpg"},{"@type":"BreadcrumbList","@id":"https:\/\/www.hongkiat.com\/blog\/ios-development-guide-part2-your-first-app\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https:\/\/www.hongkiat.com\/blog\/"},{"@type":"ListItem","position":2,"name":"iOS Development Guide: Creating Your First App (Part II)"}]},{"@type":"WebSite","@id":"https:\/\/www.hongkiat.com\/blog\/#website","url":"https:\/\/www.hongkiat.com\/blog\/","name":"Hongkiat","description":"Tech and Design Tips","publisher":{"@id":"https:\/\/www.hongkiat.com\/blog\/#organization"},"potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/www.hongkiat.com\/blog\/?s={search_term_string}"},"query-input":{"@type":"PropertyValueSpecification","valueRequired":true,"valueName":"search_term_string"}}],"inLanguage":"en-US"},{"@type":"Organization","@id":"https:\/\/www.hongkiat.com\/blog\/#organization","name":"Hongkiat.com","url":"https:\/\/www.hongkiat.com\/blog\/","logo":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/www.hongkiat.com\/blog\/#\/schema\/logo\/image\/","url":"https:\/\/www.hongkiat.com\/blog\/wp-content\/uploads\/hkdc-logo-rect-yoast.jpg","contentUrl":"https:\/\/www.hongkiat.com\/blog\/wp-content\/uploads\/hkdc-logo-rect-yoast.jpg","width":1200,"height":799,"caption":"Hongkiat.com"},"image":{"@id":"https:\/\/www.hongkiat.com\/blog\/#\/schema\/logo\/image\/"},"sameAs":["https:\/\/www.facebook.com\/hongkiatcom","https:\/\/x.com\/hongkiat","https:\/\/www.pinterest.com\/hongkiat\/"]},{"@type":"Person","@id":"https:\/\/www.hongkiat.com\/blog\/#\/schema\/person\/966b2daea15283b4145e71aa98a82c2a","name":"Jake Rocheleau","description":"Jake is a writer and designer with over 10 years experience working on the web. He writes about user experience design and cool resources for designers","sameAs":["https:\/\/www.hongkiat.com"],"url":"https:\/\/www.hongkiat.com\/blog\/author\/jake\/"}]}},"jetpack_featured_media_url":"https:\/\/","jetpack_shortlink":"https:\/\/wp.me\/p4uxU-2My","jetpack_sharing_enabled":true,"_links":{"self":[{"href":"https:\/\/www.hongkiat.com\/blog\/wp-json\/wp\/v2\/posts\/10698","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.hongkiat.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.hongkiat.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.hongkiat.com\/blog\/wp-json\/wp\/v2\/users\/18"}],"replies":[{"embeddable":true,"href":"https:\/\/www.hongkiat.com\/blog\/wp-json\/wp\/v2\/comments?post=10698"}],"version-history":[{"count":3,"href":"https:\/\/www.hongkiat.com\/blog\/wp-json\/wp\/v2\/posts\/10698\/revisions"}],"predecessor-version":[{"id":73507,"href":"https:\/\/www.hongkiat.com\/blog\/wp-json\/wp\/v2\/posts\/10698\/revisions\/73507"}],"wp:attachment":[{"href":"https:\/\/www.hongkiat.com\/blog\/wp-json\/wp\/v2\/media?parent=10698"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.hongkiat.com\/blog\/wp-json\/wp\/v2\/categories?post=10698"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.hongkiat.com\/blog\/wp-json\/wp\/v2\/tags?post=10698"},{"taxonomy":"topic","embeddable":true,"href":"https:\/\/www.hongkiat.com\/blog\/wp-json\/wp\/v2\/topic?post=10698"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}