Use LEFT and RIGHT arrow keys to navigate between flashcards;
Use UP and DOWN arrow keys to flip the card;
H to show hint;
A reads text to speech;
67 Cards in this Set
- Front
- Back
ARC def + abbr
|
ARC - Automatic Reference Counting
ARC provides automatic object-lifetime management for your app, ensuring that objects remain in existence for as long as they're needed and no longer. |
|
Delegation as a design pattern
|
Delegation is a design pattern in which one object acts on behalf of, or in coordination with, another object.
|
|
Info.plist file is an (def)
|
information property list—that is, a structured list of key-value pairs that contains information about the app such as its name and icon
|
|
main function in main.m calls the UIApplicationMain function within an autorelease pool
|
@autoreleasepool {
return UIApplicationMain(argc, argv, nil, NSStringFromClass([HelloWorldAppDelegate class])); } |
|
@autoreleasepool {
return UIApplicationMain(argc, argv, nil, NSStringFromClass([HelloWorldAppDelegate class])); } explain |
call to UIApplicationMain creates an instance of the UIApplication class and an instance of the app delegate
he main job of the app delegate is to provide the window into which your app’s content is drawn. The app delegate can also perform some app configuration tasks before the app is displayed. |
|
In an iOS app, a window object provides a ?
|
In an iOS app, a window object provides a container for the app’s visible content, helps deliver events to app objects, and helps the app respond to changes in the device’s orientation. The window itself is invisible.
|
|
storyboard contains (def)
|
storyboard contains an archive of the objects, transitions, and connections that define an app’s user interface.
|
|
view controller (def)
initial view controller (def) |
view controller - is an object that manages an area of content
initial view controller - is simply the first view controller that gets loaded when an app starts. |
|
view (def)
|
A view is an object that draws content in a rectangular area of the screen and handles events caused by the user’s touches. A view can also contain other views, which are called subviews
|
|
subviews (def)
|
hen you add a subview to a view, the containing view is called the parent view and its subview is called a child view. The parent view, its child views (and their child views, if any) form a view hierarchy. A view controller manages a single view hierarchy.
|
|
MVC
|
MVC - Model-View-Controller
|
|
segue def
|
represents a transition between two scenes.
|
|
initial scene indicator def
|
initial scene indicator, which identifies the scene that should be loaded first when the app starts (typically, the initial scene is the same as the initial view controller).
|
|
first responder
|
a dynamic placeholder that represents the object that should be the first to receive various events while the app is running. These events include editing-focus events, motion events, and action messages (such as the message a button sends when the user taps it), among others.
|
|
create map
|
_MapView.mapType= MKMapTypeSatellite;
MKCoordinateRegion newRegion; newRegion.center.latitude = 38.880816; newRegion.center.longitude = -77.102156; newRegion.span.latitudeDelta = 0.234921; newRegion.span.longitudeDelta = 0.528374; [self.MapView setRegion:newRegion animated:YES]; |
|
pin for map
|
MKPointAnnotation *annotation = [[MKPointAnnotation alloc] init];
[annotation setCoordinate:coordinate]; [annotation setTitle:@"BAU - DEbich"]; [self.MapView removeAnnotations: self.MapView.annotations]; [self.MapView addAnnotation:annotation]; |
|
Basic modes for interface controls
|
active - basic button
static - dont trigger events passive - text field on a web page, user can interact and change their value but they dont trigger event |
|
All iOS controls are sub-classes of
|
UIControl
|
|
create a string appending a string variable title to it
|
statusText.text = [NSString stringWithFromat:@"%@ button pressed.", title];
"append button press." |
|
string declaration
|
NSString *title;
|
|
application delegate files (list)
|
<*>AppDelegate.h
<*>AppDelegate.m |
|
delegates (aka application delegates) - def
|
classes that take responsibility for doing certain tasks on behalf of another objects
The application delegate lets us do things at certain predefined time on behalf of the UIApplication class |
|
UIApplication class
|
every iOS application has only one instance of UIApplication, responsible for the application;s run loop and handles application-level functionality such as routing input to the appropriate contoroller class
|
|
Always use tag property to get an UI element
|
We dont want to use the name of the UI element in case we change the language
The Tag is a numerical value |
|
Opaque option in Interface Builder
|
tells iOS that nothing behind your view needs to be drawn => iOS's drawing methods will optimize the drawing speed
|
|
Clears Graphics Context option in Interface Builder
|
When it is checked, iOS will draw the entire are covered by the object in transparent black before it actually draws the object.
Turn it of for performance improvement |
|
Clip Subviews option in Interface Builder
|
When our view contains subviews, and those subviews are not completely contained within the bounds of its parent view if
checked: only portions of subviews that lie within the bounds of the parent will be drawn unchecked: subviews will be drawn completely |
|
Closing the keyboard when done is tapped
|
Keyboard is software based => we need to tell the text field to give up control so keyboard can go away.
When done is pressed DidEndOnExit event will be generated. In <*>ViewController.h add - (IBAction)textFieldDoneEditing: (id)sender; In <*>ViewController.h add - (IBAction)textFieldDoneEditing:(id)sender } [self.sender resignFirstResponder]; } In Connections connect DidEndOnExit - drag to File's Owner and connect to textFieldDoneEditing |
|
First responder (def)
|
the first responder is the control with which the user is currently interacting
|
|
Sample how to release control when background is tapped (useful for hiding keyboard on text fields)
|
in *.h add -(IBAction)backgroundTap:(id)sender;
in *.m -(IBAction)bacgroundTap:(id)sender { [self.nameField resignFirstResponder]; [self.numberField resignFirstResponder]; } in identity inspector change UIView underlying class to UIControl (by doing this we added all "button"/control events to our view) from connection drag on Touch Down to File's Owner icon and select backgroundTap |
|
Create a sting formatted with combination of string and interger and set is as text for a labelSlider
|
self.labelSlider.text = [NSString stringwithFormat:@"Value:%d", variable)
|
|
How to get the current sender
|
in 8.m
-(IBAction)switchToggled:(id)sender { UISwitch *whichSwitch = (UISwitch *)sender; .... -(IBAction)sliderChanged:(id)sender { UISlider *slider = (UISlider *)sender; .... |
|
Get switch state
|
-(IBAction)switchChanged:(id)sender {
UISwitch *whichSwitch = (UISwitch *)sender; BOOL setting = whichSwitch.isOn; [self.leftSwitch setOn:setting animated:YES]; [self.leftRight setOn:setting animated:YES]; } |
|
How to see what Segment was selected form a Segmented Control
|
-(IBAction)toggleControls:(id)sender {
if ([sender selectedSegmentIndex] == 0) { doSomethingButton.hidden = YES; } else { doSoemthingButton.hidden = NO; } } |
|
Set hidden on a control on an outlet
|
in *.h
@property (weak, nonatomic) IBOutlet UIButton *doSomethingButton; in *.m doSomethingButton.hidden = YES; |
|
action sheet (def)
|
used to force user to make a choice
user is unable to use the application until the have tapped on of the option |
|
alerts (def)
|
appear as blue rounded rectangles in the middle of the scree.
force users to respond before they are allowed to continue using the app more informative and more important messages only single button can be presented |
|
modal view (def)
|
a view that forces users to make a choice before they are allowed to continue using their application is known as modal view
|
|
create and show the action sheet
|
- (IBAction)buttonPressed:(id)sender {
UIActionSheet *actionSheet = [[UIActionSheet alloc] initWithTitel:@"Are you sure" delegate:self cancelButton:@"No Way!" destructiveButtonTitle:@"Yes, I'm sure!" otherButtonTitels:nil]; [actionSheet showInView:self.view]; } |
|
how to initialize an alert
|
UIAlertView *alert = [[UIAlertView alloc]
initWithTitle:@"Something was done" message:msg delegate:self cancelButtonTitle:@"Phew!" otherButtonTitles:nil]; ]; [alert show]; //will cause the alert to be displayed |
|
stretchable images (def)
end caps (def) |
a re-sizable image that know how to re-size itself intelligently so that it maintain the correct appearance
part of an image (measured in px) that should not be resized |
|
iPhone/iPod touch resolution dimension
iPad status bar dimension |
320 x 480
768 x 1024 20 px |
|
retina display def and dimension
|
term for the high res screen on iPhone 4/4s
640 x 960 |
|
approaches for auto rotation
|
autosize attributes for simpler interfaces
manual re-positioning of objects in view when notified that view is rotating actually design tow different version of view (1 for portrait/1 for landscape) |
|
What plist file contains information about the orientation supported by our app
|
Auosize-Info.plist
in the Supporting Files an entry called either UISupportedInterfaceOrientation or Supported Interface Orientation |
|
What method is called automatically after a rotation has happened but before the final rotation animations have occured
|
willAnimateRotationToInterfaceOrientation:duration in BIDViewController.m
|
|
The size and position of all views, including controls such as buttons, are specified in a property called ______, which is a struct of type ______
|
frame
CGRect CGReckMake is a function provided by apple that lets you specify the x and y position along with the width/height of an element |
|
define C macro
|
#define degreesToRadians(x) (M_PI * (x) / 180.0)
|
|
upgraded to Xcode 4.3 from 4.2 and it seems they have gotten rid of the New File option to add a UIViewController subclass in 4.2
and in 4.3 |
4.2
File => New File... => Cocoa Touch => UIViewController subclass. 4.3 File => New File... => Cocoa Touch => Objective-C class => choose "subclass of" UIViewController. |
|
This callback occurs when the view controller is rotating to a new orientation. It looks at the orientation the view controller is rotating to and resizes the views appropriately – in this case with hardcoded offsets based on the known screen dimensions of the iPhone. This callback occurs within an animation block, so the changes in size will animate.
|
(void)willAnimateRotationToInterfaceOrientation:(UIInterfaceOrientation)toInterfaceOrientation
duration:(NSTimeInterval)duration |
|
autosizing masks aka ? + def
|
known as the “springs and struts” model
autosizing mask determines what happens to a view when its superview changes size. Does it have flexible or fixed margins (the struts), and what happens to its width and height (the springs) |
|
turn AutoSizeing off
|
select *.nib/xib
select file inspector uncheck "Use Autolayout" Auto Layout is available only in iOS 6 |
|
custom view handling between landscape and portrait mode
|
connect each view to ViewController.h
over wride the - (void)WillAnimateRotationToInterfaceOrientation:(UIInterfaceOrinetation)toInterfaceOrientation duration:(NSTimeInterval)duration |
|
Constraints are objects of what class
|
NSLayoutConstraint
|
|
intrinsic content size def
|
element that know how wide it must be
UIButton and UILabel are intrinsic |
|
Typically you would override _______________________ to change the frames of any views that need to be rearranged.
|
willAnimateRotationToInterfaceOrientation:duration:
|
|
Check if button's title is equal to X and change it to "A very long title for this button" other wise set it to X
|
- (IBAction)buttonTapped:(UIButton *)sender
{ if ([[sender titleForState:UIControlStateNormal] isEqualToString:@"X"]) [sender setTitle:@"A very long title for this button" forState:UIControlStateNormal]; else [sender setTitle:@"X" forState:UIControlStateNormal]; } |
|
animation curve def
|
determines the timing of the animation.
default is a linear curve, causes the animation to happen at a constant speed [UIView setAnimationCurve: UIViewAnimationCurveEaseInOut]; 4 iOS transition are available UIViewAnimationTransitionFlipFromLeft UIViewAnimationTransitionFlipFromRigh UIViewAnimationTransitionCurlUp UIViewAnimationTransitionCurlDown |
|
header file sample
|
#imports
@interface <nameofclass> : <parentobject> { ... } @end |
|
NSObject requires what heather file
|
Reuqires Foundation framework
#import <Foundation/Foundation.h> |
|
All classes in Objective C have _________________ and _____________
|
header files
implementation files and the header file is the public API |
|
- (void)setOperand:(double)anOperand;
vs -setOperand:(double)anOperand; |
with (void) method returns void
without anything returns an object |
|
pointer to an object (string)
|
(NSString *)operation;
Always allocated on the heap |
|
- (NSArray *)foo: (int) bar:(id)pow;
how is this method called and how many arguments it takes |
takes two arguments and is called foo:bar:
(foo colon bar colon) |
|
Determining whether you’re compiling for a simulator
|
#if TARGET_IPHONE_SIMULATOR
NSString *hello = @"Hello, iOS Simulator!"; #else NSString *hello = @"Hello, iOS device!"; #endif |
|
how to use the TARGET_OS_IPHONE macro in a source file to be shared between Mac OS X and iOS
|
#if TARGET_OS_IPHONE
#import <UIKit/UIKit.h> #else #import <Cocoa/Cocoa.h> #endif |
|
The TARGET_OS_IPHONE and TARGET_IPHONE_SIMULATOR macros are defined in the _____________________ header file.
|
TargetConditionals.h header file.
|