ios apps revision

31
Final Revision by Mohamed Amin IOS Track

Upload: muhammad-amin

Post on 19-May-2015

973 views

Category:

Education


1 download

DESCRIPTION

IOS Apps Revision

TRANSCRIPT

Page 1: IOS APPs Revision

Final Revision by Mohamed Amin

IOS Track

Page 2: IOS APPs Revision

AgendaMain Components Covered during the Course

UINavigationController

UITableView

UITabBar

UIWebView

UITextView

UIImageView

MKMapView

UIAlertView

Working With UserDefaults and Plists

Page 3: IOS APPs Revision

Listtable

Grouped

TextViewTabBar

Navigation

ImageView

Maps

Page 4: IOS APPs Revision

UINavigationController

Define a property of UINavigation Controller

Synthesize your property

Add this component to your Window As Subview

Drag and Drop your Component in Interface Builder

Connect your property to this Component

Define your RootView xib and Class if you don`t have one , Start to make a new View and make it as a root

How to use it ?

No More !

Page 5: IOS APPs Revision

UINavigationController

[PushViewController:(UIViewController) animated:(animated)];

[navigation PopViewController];

[navigation Pop toViewController:];

Important Methods ?

Page 6: IOS APPs Revision

Test Example ?UINavigationController

Page 7: IOS APPs Revision

UITableView

Create New View Controller with TableView Type

Define your Data Source (Arrays or Dictionary or Something else)

Define Table layout number of Sections and rows

implement Delegate methods you will need like CellForRow , didSelectRowAtIndexPath and More

How to use it ?

No More !

Listtable

Grouped table

Page 8: IOS APPs Revision

UITableView

[myTable reloadData]

[myTable reloadRowsAtIndexPaths: withRowAnimation:]

Important Methods ?

Page 9: IOS APPs Revision

UITableView

didSelectRowAtIndexPath:(NSIndexPath *)indexPath

numberOfRowsInSection:(NSInteger)section{

-(NSInteger)numberOfSectionsInTableView:(UITableView *)tableView{

cellForRowAtIndexPath:(NSIndexPath *)indexPath

Important Delegate Methods ?

Page 10: IOS APPs Revision

Test Example ?UITableView

Page 11: IOS APPs Revision

UITabBarView

Define a property of UITabBarController

Synthesize your property

Add this component to your Window As Subview

Drag and Drop your Component in Interface Builder

Connect your property to this Component

Define your First View and Second View xib and Class if you don`t have one , Start to make Views !!

How to use it ?

No More !

Page 12: IOS APPs Revision

Test Example ?UITabBarView

Page 13: IOS APPs Revision

UIWebView

Define a property of UIWebView

Synthesize your property

Drag and Drop your Component in your View in Interface Builder

Connect your property to this Component

Start to use it !!

How to use it ?

No More !

Page 14: IOS APPs Revision

UIWebView

(void)webViewDidFinishLoad:(UIWebView *)webView

(void)webViewDidStartLoad:(UIWebView *)webView

- (BOOL)webView:(UIWebView *)webView shouldStartLoadWithRequest:(NSURLRequest *)request

Important Delegate Methods ?

No More !

Page 15: IOS APPs Revision

UIWebView

[self.webView loadRequest]

[self.webView loadHTMLString]

Important Methods ?

Page 16: IOS APPs Revision

Test Example ?UIWebView

Page 17: IOS APPs Revision

UITextView

Define a property of UITextView

Synthesize your property

Drag and Drop your Component in your View in Interface Builder

Connect your property to this Component

Start to use it !!

How to use it ?

No More !

Page 18: IOS APPs Revision

Test Example ?UITextView

Page 19: IOS APPs Revision

UIImageView

Define a property of UIImageView

Synthesize your property

Drag and Drop your Component in your View in Interface Builder

SetYourImage using interface Builder OR using your Code

Connect your property to this Component

Start to use it !!

How to use it ?

No More !

Page 20: IOS APPs Revision

UImageView

[self.imageView SetImage:[UIImage imageNamed: @”image.png”]];

Important Methods ?

Page 21: IOS APPs Revision

Test Example ?UIImageView

Page 22: IOS APPs Revision

MKMapView

Define a property of MKMapView

Synthesize your property

Drag and Drop your Component in your View in Interface Builder

Connect your property to this Component

Start to use it !!

How to use it ?

No More !

Page 23: IOS APPs Revision

MKMapView

RegionWillChangeAnimated

RegionDidChangeAnimated

Important Methods ?

Page 24: IOS APPs Revision

Tested Last lecture :)MKMapView

Page 25: IOS APPs Revision

UIAlertView

UIAlertView *alert = [[UIAlertView alloc]

initWithTitle:@”No data yet!”

message:@”No data has been received yet.”

delegate:nil

cancelButtonTitle:nil

otherButtonTitles:@”OK”, nil];

[alert show];

How to use it ?

No More !

Page 26: IOS APPs Revision

Tested it ?UIAlertView

Page 27: IOS APPs Revision

Working With UserDefaults and Plists

Page 28: IOS APPs Revision

UserDefaults

Definition:

NSUserDefaults *defaults = [NSUserDefaults standardUserDefaults];

Usage

- (void)setBool:(BOOL)value forKey:(NSString *)defaultName

- (BOOL)boolForKey:(NSString *) defaultName

The same setters and getters are found for string, arrays, integers and floats

How to use it ?

No More !

Page 29: IOS APPs Revision

PlistsTo Read :

NSString *path = [[NSBundle mainBundle] pathForResource:plist ofType:@"plist"];

NSMutableDictionary *dic = [[NSMutableDictionary alloc] initWithContentsOfFile:path];

NSLog(@”Contents is %@”,dic);

To Write

NSString *path = [[NSBundle mainBundle] pathForResource:plist ofType:@"plist"];

NSMutableDictionary *dic = [[NSMutableDictionary alloc] initWithContentsOfFile:path];

[dic SetObject:@”Test” ForKey:@”mykey”];

How to use it ?

No More !

Page 30: IOS APPs Revision

Any Questions ?

Page 31: IOS APPs Revision

Ready For The Project ?