How can we help?

You can also find more resources in our Help Center.

248 terms

iOS5 App Development Basics

The essentials about iOS application development for iPhone/iPad/iTouch
STUDY
PLAY
Used to test an app without needing an actual physical device
iOS Simulator
Allows you to easily track multiple versions of your project
Snapshot feature
IDE for iPhone Development
Xcode
API
"Application Programming Interface"
Dimensions of iPhone (in points)
320 x 480
Dimensions of iPad (in points)
1024 x 768
RAM for iPhone
512MB
Extension for an iPhone/iPad app
xcodeproj
Language used to write iOS apps
Objective-C
Defines the functional building blocks (classes) that make iOS devices perform certain actions
Cocoa Touch
Collection of interface elements and data storage elements etc you can access from your applications
Cocoa Touch
iOS functional building blocks
Classes
Development approach (design pattern) to structure iOS applications
Model-View-Controller
MVC
Model-View-Controller
IDE
"Integrated Development Environment"
OOP
Object-oriented programming
Defines what an object can do
class
Class that builds upon another class
subclass
Class that another class inherits from
superclass
Process of creating an active object from a class
instantiation
Calling a method is the same as...
...sending an object a message
Storage location for a piece of information
variable
Storage place for a piece of information specific to a class
instance variable
Piece of information provided to a method when it is messaged
parameter
Way to refer to an object within its own methods
self
Master class in iOS
NSObject
Objective-C is an extension (super set) of...
...C
Files used to create a class
interface and implementation files
Extension for interface file
h
Extension for implementation file
m
Synonym for interface file
header
Used to define a list of all methods and properties a class uses
interface file
This file contains the code that makes everything 'work'
implementation file
Directive to include other interface files that an application might need to access
import
Syntax to include the fictitious user-created file: 'myFile.h'
#import "myFile.h"
Syntax to include UIKIT in a class
#import <UIKIT/UIKIT.h>
Delimiter for a list of protocols
<>
Syntax for single-line comment
//blah blah blah
Syntax for block-comment
/*blah blah blah */
A class that implements a protocol is said to ____ to that protocol
conform
Given:
#import <UIKit/UIKit.h>
@interface WelcomeViewController : UIViewController
@end

The superclass for WelcomeViewController
UIViewController
Symbol used for inheritance
:
Companion to the @property directive
@synthesize
getters
accessors
setters
mutators
Something the simulator cannot reliably test
performance
Used to set up an outgoing connection from the implementation code to the view
IBOutlet
Term used to describe each screen of an iPhone app
view
Framework used to write iPhone apps
Cocoa Touch
Used to receive an event in code and trigger something
IBAction
Document Apple uses to evaluate apps for the App Store
Human Interface Guide
This type of app is typically one screen, and gives you the basics with minimal interaction
utility
These define to which messages the datasource and delegate respond
protocols
This type of app typically involves hierarchical data
productivity
This type of app is mostly custom controllers and graphics
immersive
Other name for an *.xib file
nibfile
To use a new class you need to _____ it
instantiate
The '@' symbol is shorthand for creating one of these
NSString
A tool in Xcode to help fix broken code
debugger
The HIG requires some kind of _____ element in a cell if there is more information available
disclosure
strong and nonatomic are examples of ...
attributes
Attribute that informs the system that the object referred to needs to be kept around and not discarded from memory
strong
Attribute that informs Xcode not to worry about different parts of the application using a property at the same time
nonatomic
Denotes a class method
+
Denotes an instance method
-
Return type indicating a method returns nothing
void
Used to indicate any type of object
id
Closes an interface file
@end
Syntax for declaring a variable
<type> <variableName>;
Data type for whole numbers
int
Data type for numbers with 'tame' numbers of decimal points
float
Data type for highly precise numbers with huge numbers of decimal places
double
Syntax for declaring a string called 'userName'
NSString *userName;
Syntax for reserving memory and initializing an object
[[<class name> alloc] init];
Write a statement to declare and initialize a label object called 'myLabel'
UILabel *myLabel = [[UILabel alloc] init];
Write a statement to declare and initialize a label object called 'myLabel' to "GO!"
UILabel *myLabel = [[UILabel alloc] initWithString:@"GO!"];
Apple's classes often provide a special initialization method called a _____ method
convenience
Consider:
int x = 6;
int y = 7;
float quotient = (float) x/y;
The statement that creates the variable 'quotient' is an example of ....
casting
Syntax for sending an object a message with no parameters
[<object variable> <method name>];
Syntax for sending an object a message with one parameter (p1)
[<object variable> <method name>: p1];
If a method name includes a colon (:) this indicates a required _________
parameter
Indicates a lack of any value at all
nil
Tests to see whether two values are equal
==
Tests to see whether two values are not equal
!=
Implements a logical AND condition
&&
Implements a logical OR condition
||
Name of the '|' symbol
pipe
Negation symbol
!
Two-way selection logic block
if(<boolean condition>){
/* stuff to do*/
} else{
/*stuff to do*/
}
Alternative selection mechanism when many conditions exist
switch
Fixed iteration repetition control structure syntax
for(<initialization>;<test condition>;<update instruction>){
/*do this over and over*/
}
Shortcut for writing: count = count + 1;
count++;
Shortcut for writing: x = x - 1;
x--;
Shortcut for writing: y = y * 5;
y *= 5;
Precondition repetition structure syntax
while(<boolean expression>){
/*stuff to do here*/
}
Postcondition repetition structure syntax
do{
/*stuff to do here*/
}while(<boolean expression>);
Prior to ARC, you used these terms alot
retain, release, dealloc, autorelease
Another name for format specification
token
Method used to print information in an output panel
NSLog
Declare and initialize a string that says: "Hello World" whose identifier if 'phrase' . Use the shortest command possible.
NSString *phrase = @"Hello World";
Symbol often denoting a 'pointer'
*
NS stands for...
NeXSTEP
What's the difference between Cocoa and Cocoa Touch?
Cocoa is the development framework used for most native Mac OS X applications; Cocoa Touch is customized for a touch interface
4 Top down technology layers making up iOS
Cocoa Touch, Media, Core Services, Core OS
The first method called when a user taps an application icon
main()
True or false: Beginning with iOS4, applications no longer terminate when the user presses the Home button
true
Every iOS application implements a subclass of _________
UIApplication
The ________ class provided a container for the management and display of views
UIWindow
Class of strings that can be changed
NSMutableString
______ enable applications to store multiple pieces of information in a single object
Collections
An example of a common collection data type
NSArray
Always used to end the list of objects when initializing an array
nil
Class that creates an array capable of being changed after it is create
NSMutableArray
Class of collection data type which stores information as object/key pairs
NSDictionary
Class used to work with dates as objects
NSDate
Class that allows URL management
NSURL
Single line text field
UITextField
Multiline text entry block
UITextView
Resembles a slot machine display
UIPicker
Opens the Xcode Quick Help Assistant
Option-click a symbol
The object currently in control and interacting with the user
First Responder
The name of the panel to the left of the Interface Builder Editor panel
Document Outline Area or Outline View
The Round Rect Button is found in this library
Object Library
What do the Autosizing settings of the Size Inspector do?
Determine how controls resize/reposition themselves when a device changes orientation
You have two labels in Interface Builder. One is selected (You clicked on it). How can you tell the distance between it and the other label?
Hold down the Option key and point to the other label. The distance will be shown
The Inspector you would use to tweak the way interface objects appear
Attributes Inspector
The Inspector you would use to control your layout in Interface Builder
Size Inspector
IB
"Interface Builder"
The Inspector you would access to gain access to various accessibility attributes
Identity Inspector
Word used to indicate that a user can't interact with a given element
static
Another name for a 'button bar'
segmented control
An integrated web browser component
web view
A skeleton (holding place) or framework of code that will be completed in the future; provided initially so code will compile (but it may not function)
stub
The Inspector you will need if you want to connect a custom class to an object in Interface Builder
Identity Inspector
Apps written to assist users with special disabilities
accessible apps
In the MVC design pattern for iOS apps, this aspect provides the underlying data and methods that offer information to the rest of the application
model
In the MVC design pattern for iOS apps, this aspect consists of the various onscreen 'widgets' a user can interact with
view
In the MVC design pattern for iOS apps, this aspect is responsible for receiving user input and acting accordingly, and serves as a 'bridge' between the other two components. It is the backbone of the app.
controller
The goal of the MVC design pattern
Isolate the functional components of an app
An _______ is used to enable your code to talk to objects within views
IBOutlet
True or false: Although it is possible to declare an instance variable and then define a corresponding property, you may also use @property alone to implicitly declare a matching instance variable
true
Creates 'getters' and 'setters'
@synthesize directive
An _______ is used to 'advertise' a method in your code that should be called when a certain event takes place
IBAction
Declaring a method in an interface file, before it is actually implemented is called _______ the method
prototyping
What event do you use to detect a button tap?
Touch Up Inside
Which Apple project template creates a simple view/view controller application
Single View Application
What is the relationship between storyboards, scenes, views, and view controllers?
A scene is where you edit a view and assign a controller to it. Storyboards are the files that contain all the scenes you will use in a project.
SDK
"Software Development Kit"
Extension for MainStoryboard
storyboard
Purpose of the "Auto-enable Return Key" attribute for text fields
Disables the Return key on the keyboard unless the user has entered at least a single character of input into the field
Purpose of "Secure" attribute for text fields
Treats the field as a password, hiding each character as it is typed
What are data detectors?
Attribute settings for some onscreen controls (like text areas) that analyze content and provide helpful links based on what they find. For example, phone numbers can be touched to dial the phone; web addresses can launch Safari if tapped, etc
A common button type that indicates additional information is available
detail disclosure
Recommended image type for button graphics
png
How do you show a storyboard file as source code?
Right-click on it in the Navigator panel and choose "Open as..." and select "Source Code"
What computer language is the storyboard written in?
XML
Key sequence to open the Project Navigator (left panel)
Command+1
For a text field, what does the "Clear Button" look like?
Gray circle with a white "X" in it, positioned to the right of the text field box
How do you get rid of an onscreen keyboard?
Send the 'resignFirstResponder' message to the object that currently controls the keyboard (such as a text field)
XML
eXtensible Markup Language
Used to display image file resources and show simple animations
image view
Class used for creating image views
UIImageView
Under what circumstances would you need an outlet for a button if it's just needed to trigger an action?
To provide a convenient way of setting the button's title in the code
Key sequence to open the Attributes Inspector
Option+Command+4
Property affecting an element's transparency
alpha
A fully opaque image has an _______ property value of ______
alpha ... 1
A fully transparent image has an _____ property value of _____
alpha ... 0
If you have an image file called 'myImage.png' and you make a hi-res version for the retina display, what should be the name of the new file?
myImage@2x.png
Scaling factor to make an image suitable for retina display
2
File name suffix indicating an image is suitable for retina display
@2x
This element should 'always' accompany a slider to indicate its purpose
label
In a stepper control, when this attribute option is checked, the stepper's value is automatically set to the minimum value when the maximum value is exceeded (or vice versa).
wrap
Boolean for 'true' in Objective-C
YES
Boolean for 'false' in Objective-C
NO
Expression to create a random number in [0,20];
rand( )%21
Modulus (remainder) operator
%
Formatting placeholder for strings
%@
Formatting placeholder for integers
%d
Formatting placeholder for a floating point value with one digit on the left of the decimal and two digits on the right
%1.2f
What property needs to be set before a scroll view (UIScrollView) will scroll?
contentSize
What type of object does a web view expect as a parameter when loading a remote URL?
NSURLRequest
Define a collection of methods to perform a task
protocols
A class that manages the user's interaction with the iDevice
view controller
The visual layout that a user sees on the screen
view
A unique combination of view controller and view
scene
A transition between scenes, frequently with a visual transition effect applied
segue
A view that is displayed on top of an original view when user interactions are required
modal views
This file contains the scene, segue and relationship definitions for your project
storyboard
Correct the error: label.text = "Hello World
!";
label.text=@"Hello World!";
Character used to show an element as a literal string
@
Crash statement likely when an NSString is assigned a value with an incorrect format
Program received signal: EXC_BAD_ACCESS
Key sequence to save an Xcode file
Command+S
Key sequence to run an app in Xcode
Command+R
Name of the drop-down menu in Xcode that lets you select the device used with the iOS Simulator
Scheme
A file folder in the navigator panel is called a ________
Group
Key sequence to hide/show Navigator View
Command+0
Key sequence to hide/show Utilities View
Option+Command+ 0
Key sequence to hide/show the Assistant Editor
Option+Command+Return
Key sequence on a Mac to select between open application
Command + Tab
Key sequence to open the Standard Editor
Command+Return
Connections between Objects in the Interface Builder and the header file are formed by _____-_______ from the object to the proper place in the header file
control-dragging
UI
User Interface
Proper way to pronounce a *.xib file
Nib (but a few call it 'zib' but that's not preferred)
Any 'directive' statement begins with this symbol
@
True or false: iPhone and iPad do not support .png transparency
true
Size of iPhone 'lo-res" icon image in pixels
57 x 57
Size of iPhone retina icon image in pixels
114 x 114
'plist' stands for...
property list
This keyword in the property directive is related to the concept of mutability and basically asks Apple to handle the details. This is the more 'relaxed' , less 'powerful' setting of two possibilities
nonatomic
This keyword in the property directive is related to memory management and refers to the idea that we want to maintain control of memory issues
retain
You have an instance variable called 'myLabel' that is a member of UILabel. In an app, you set it's text property to "Howdy" with the correctly-written command: myLabel.text = @"Howdy"; Re-write this command using [ ] message-sending syntax
[myLabel setText:@"Howdy"];
In the US, the '#' symbol is often called the ____ symbol
pound
In the UK, the '#' symbol is often called the ____ symbol
hash
Data type for true/false type variables
bool
Typical header syntax for a button that will be applying the 'moveMe' action in an app
- (IBAction)moveMe:(id)sender;
@property directives should be placed ____ (above or below) any IBActions in the header file
above
@synthesize directives should be placed _____ (above or below) the @implementation directive in the implementation file
below
In your implementation file, the _____ method (provided in stub form by Apple) runs after machine language code reserves some space in memory for your View. This method is often used to create a 'clean slate' as an app opens.
viewDidLoad
Write a line of code creating a pointer to a wall paper image called 'wp1' that refers to a resource in an app with the file name 'wallPaper_01.png'
UIImage *wp1 = [UIImage imageNamed:@"wallPaper_01.png"];
An array of background images called 'bgImages' has been declared as an instance variable in your header file. You have created a set of 5 background images stored in UIImage variables wp1 through wp5. Write a line of code that initializes the array.
bgImages = [[NSArray alloc] initWithObjects: wp1, wp2, wp3, wp4, wp5, nil];
Scaling, rotation, and translation are the most commonly used manipulations supported by _____ transforms, but skewing is also possible.
affine
Class used for image manipulations such as scaling, rotation and translation. Its data structure represents a matrix used for affine transformations.
CGAffineTransform
A view has a 'Shrink' button whose label needs to change once it is clicked to 'Grow'. Write a 'message' type command to change it's label to 'Grow'
[shrinkButton setTitle:@"Grow" forState: UIControlStateNormal];
An app has boolean variables 'hasShrunk' and 'hasMoved'. Write a boolean condition that checks if each are true
hasShrunk==YES && hasMoved == YES
This Xcode utility allows you to check CPU usage, memory allocation and network/file access (among other things)
Instruments
A virtual 'box' for organizing related projects
workspace
You are creating an app for a company whose URL is http://www.fannypackapps.com . What should be the company identifier for the app when you begin the project?
com.fannypackapps
What are the guidelines for the class prefix for a project?
Something unique, based on the app's name (perhaps abbreviated). Avoid 'NS' or 'UI' since they are used in Apple's frameworks. A framework or library should always be prefixed. For a simple app, they are not necessary.
Apps that provide easy access to a single screen of information with a backside view for modifying preferences
Utility apps
If you wish to 'echo print' breadcrumb info as you develop your app, this panel must be visible
The Console area of the Debug area
The 'First Responder' in a scene is not an object it is considered a ________
proxy
To zoom between an overview of the entire storyboard and the actual size view, ______ the storyboard background.
Double-click
To unroll or roll up a hierarchy of files, objects or classes, you click the ______ _______ at the root element
disclosure triangle
______ are variables that can store a ____ to an object.
Outlets ... pointer
_____ are methods that we can connect to events.
Actions
______ and ______ define the connections between scenes.
Seques .... relationships
In most graphical user interfaces, a _____ view is a view that must be dismissed ('OK' button, 'Cancel' button for example) before the user can perform any other actions in the application.
modal
Code fragment for echo printing the name of a function as it loads (for tracing the sequence of code in a project...leaving breadcrumbs)
NSLog(@"%s", __FUNCTION__);
An alternative way to see the connections between an object in the Interface Builder and it's code in Xcode without using the Connections inspector
Control-click on the View Controller's icon to bring up a Connections dialog
The bar across the top of the Editor area that shows you the item you are editing
Jump Bar
The Utilities area has two sections: ______ and ______
inspector and library
The library that contains the objects you can add to a view or XIB file
Object library
Templates fill in a bunch of ______-_______ code that serves as a framework in which to write future implementations
boiler-plate
"Build and run" keyboard shortcut
Commmand-R
Memory aid for keyboard shortcuts in the Navigator panel
Command plus the navigator's position in the selector. For example, the project navigator shortcut is Command-1
You have created some 'breadcrumbs' using NSLog to trace the path of your code, and the debug area is open, yet you see no information in the panel. What's the problem and what is the solution?
Look at the three icons at the upper left portion of the Debug console. The far left one, "Show only the Variables View" will not show the NSLog-ed information. Click the center icon ("Show the Variables View and the Console") or the right icon ("Show only the Console") and you will see your logged information.
Combining two messages into a single line of code
nested message send
Given: [graduationParty addAttendee: @"Aunt Jane" withDish: @"deviled eggs"]; The 'receiver' is _______; the 'selector' is _________
graduationParty ... addAttendee:withDish