You are on page 1of 4

IOS Essential Notes - Lydia.

com IOS Course


-------------- @Property
@interface Myclass: NSObject {
}
@property (nonatomic) int score;
----------------------------------------------------------------------------------atomic - thread safe : Its the default
nonatomic - fast but not thread safe
----------------------------------------------------------------------------------Strong (we own it, strong reference) and weak (weak reference)
----------------------------------------------------------------------------------@Synthesize (older code use this to generate getter and setters but not required
now)
----------------------------------------------------------------------------------bob.score = 100; [dot syntax works only for getter and setter methods]
----------------------------------------------------------------------------------MVC:
====
Model
: text files, DB, Image files etc
Controller : Objective C [ .m & .h Xcode files]
View
: storyboard and .xib files
Action : Flows from View to Controller (method) ex: button click calls a method.
This methos is the action
Outlet : From Controller(IBOutlet* deiniftion) to View
A single UI element (Text field etc) can be both Outlet and Action
----------------------------------------------------------------------------------------UI elements
View --> Utilities --> Show object lib
----------------------------------------------------------------------------------------IBAction - When the view element is dropped into the view Controller.m
1. Drag a button in the implementation - IBAction
2. Drag a text into the @interface - IBOutlet
pointing to the margin next to the Outlet Code in the View Controller shows the
link on the Storyboard
----------------------------------------------------------------------------------Dismissing Delegation:
----------------------------------------------------------------------------------First Responder : [textfield resignFirstResponder]
---------------touchesBegan: (NSet*)touches withEvent (UIEvent *) event{

[self view endEditing:YES]


}
----------------------------------------------------------------------------------Video 4_4_DismissDelegation:
Make the ViewController the 'delegate' for the text field.
Events from Text field which the delegate handles: When the text field is beginn
ing editing, Clear field
----------------------------------------------------------------------------------Delegate Protocol : Delegate class adheres to this.
Use <> brackets to implement
1.
2.
3.
4.

Read the Delegate Protocol


Delegate class defined.
Implement the required methods
Connect the delegate class to the delegated object.

----------------------------------------------------------------------------------Video 04_06:
Show Message Window:
UIALertView : initWithTitle
[myAlert show]
Hit Home Button : then app is not killed, but paused?
----------------------------------------------------------------------------------main.m
UIApplicationMain(argc, argv, nil, delegate);
//delegate is AppDel
egate.m
UIApplicationMain() : Pass Delegate
---->
---->
othing is visible yet
---->
---->
espan of the app
---->
---->

UIApplication
Calls Primary UI file (Storyboard/xib) : n
Calls your app delegate
UIWindow : transparent, exists for the lif
Loads View Controller into the UIWindow

While app is loading:


# applicationDidFinishLoadingWithOptions() (LifeCycle methods in AppDelegate)
# viewDidLoad & viewWillAppear (LifeCycle methods in viewController)
After App loads
# applicationDidBecomeActive()
# viewDidAppear() (viewController)
# Go through AppDelegate.
------------------------------------------------------------------------------------------------------------------------------IOS Project Templates:
Single View
Multiple View
Page View
Tabbed Application : Clock App

Utility App : With a flip view : IOS 7 moved away from this style
Empty Appl.
OpenGL & SpriteKit
------------------------------------------------------------------------------------------------------------------------------Do a SingleViewApplication first. Check out the Exercise files
------------------------------------------------------------------------------------------------------------------------------DatePicker or Picket : Connect a DataSource and Delegate for handling the select
Row etc
Use UIDatePicker Protocols for defining these.
- Connect
------------------------------------------------------------------------------------------------------------------------------DatePicker example :
Connect DatePicker as Outlet and Button as Action
An Outlet also lets you access to a control(read, write)
NSDate *Chosen = [self.datePicker date];
// EEEE represents date of the week in full ie., Monday etc
NSDateFormatter has setDateFormatter:@"EEEE"
//100s of different formats
------------------------------------------------------------------------------------------------------------------------------- define a property in .h and it becomes a public variable
- define a property in .m and it becomes a private variable
------------------------------------------------------------------------------------------------------------------------------- Practice arrays and different ways to use them
------------------------------------------------------------------------------------------------------------------------------TableView Notes:
Using Plist file and load the values into the table view.
Copy the plist from mac dir to the Xcode Project Supporting files.
Loading the Plist into runtime use:
In viewDidLoad:
NSDictionary* : It is not a 0 based data structure.
NSURL and NSBundle
- urlForResource
- Use the URL to make the NSDictionary??
NSDictionary dictionaryWithContentsOfURL
NSDictionary allKeys
Protocoal Methods to Implement :
- numberOfRowsInSection()
- cellForRowAtIndexPath()
declare variable of type UITAbleViewCell
Call dequeueCellForReuseCellWithIdentifier
- Efficient way to dequeue any cell
- Provide one cell to implement scrolling and resuing cells.
Utilities Panel. Attribute details inspector on RHS. In 'Prototype Cell' use
value 1
Identifier : 'cell' (same as in code)
------------------------------------------------------------------------------------------------------------------------------- Default Multi View template app has both Nav. Controller and
- Every method has a description method.

You might also like