iOS (previously iPhone OS) is a mobile operating system developed by Apple Inc. and distributed exclusively for Apple mobile devices. It is the operating system that powers iphones. Native applications developed using iOS enhance user experience and enable users to access information and enjoy games and music.
Before you start Deveoping iOS Applications
Before you start developing applications, set up a development environment to work in and make sure you have the correct tools.
Xcode is Apple’s integrated development environment (IDE). Xcode includes a source editor, a graphical user interface editor, and many other features. The iOS SDK extends Xcode to include the tools, compilers, and frameworks you need specifically for iOS development.
The first step in developing applications is to Download Xcode/SDK from iOS Dev Center at http://developer.apple.com, you must also join iOS Developer Program which is per [$99/year] for all devices.
iOS Operating System has 4 layers
Model-View-Controller (MVC) is central to a good design for any iOS app. MVC assigns the objects in an app to one of three roles: model, view, or controller. In this pattern, models keep track of your app’s data, views display your user interface and make up the content of an app, and controllers manage your views. By responding to user actions and populating views with content from the data model, controllers serve as a gateway for communication between the model and views.
As you’ve built your ToDoList app, you’ve followed an MVC-centric design. The interface you built in storyboards makes up the view layer.
ToDoListTableViewController are the controllers that manage your views. In Tutorial: Add Data, you’ll be incorporating a data model to work with the views and controllers in your app. When you begin designing your own app, it’s important to keep MVC at the center of your design.
Target-action is a conceptually simple design in which one object sends a message to another object when a specific event occurs. The action message is a selector defined in source code, and the target—the object that receives the message—is an object capable of performing the action, typically a view controller. The object that sends the action message is usually a control—such as a button, slider, or switch—that can trigger an event in response to user interaction such as tap, drag, or value change.
For example, imagine that you want to restore default settings in your app whenever a user taps the Restore Defaults button (which you create in your user interface). First, you implement an action,
restoreDefaults:, to perform the logic to restore default settings. Next, you register the button’s Touch Up Inside event to send the
restoreDefaults: action method to the view controller that implements that method.
You’ve already used target-action in your ToDoList app. When a user taps the Done button in the
AddToDoItemViewController, it triggers the
unwindToList: action. In this case, the Done button is the object sending the message, the target object is the
ToDoListTableViewController, the action message is
unwindToList:, and the event that triggers the action message to be sent is a user tapping the Done button. Target-action is a powerful mechanism for defining interaction and sending information between different parts of your app.
Delegation is a simple and powerful pattern in which one object in an app acts on behalf of, or in coordination with, another object. The delegating object keeps a reference to the other object—the delegate—and at the appropriate time, the delegating object sends a message to the delegate. The message informs the delegate of an event that the delegating object is about to handle or has just handled. The delegate may respond to the message by updating the appearance (or state) of itself or of other objects in the app, and in some cases it will return a value that affects how an impending event is handled.
Now that you have learned the concepts, let us start creating the iOS application.
The View-based Application template in Xcode creates an empty View as well as a subclass to be your Controller (with a little bit of template code in it). The other templates in this dialog create applications with either no View/Controller (Window-based Application) or with a more sophisticated Controller and View (e.g. Navigation-based Application, Tab Bar Application or Split View-based Application). In this course, we will only be using the simple View-based Application template or the Window-based Application template (in which case we will build our more sophisticated Controllers in source code rather than using these templates).
Note that in the Classes section Xcode has automatically created .h and .m files for two different classes: CalculatorAppDelegate and CalculatorViewController. Don’t worry about CalculatorAppDelegate for this assignment. The second one, CalculatorViewController, is the source code for our Controller. We’ll create a new class in a moment called CalculatorBrain to be our Model. So what about our View? We’ll create that later using a graphical tool (which will store our work in the file CalculatorViewController.xib).