IOS APPs Revision

Post on 19-May-2015

967 views 1 download

Tags:

description

IOS Apps Revision

Transcript of IOS APPs Revision

Final Revision by Mohamed Amin

IOS Track

AgendaMain Components Covered during the Course

UINavigationController

UITableView

UITabBar

UIWebView

UITextView

UIImageView

MKMapView

UIAlertView

Working With UserDefaults and Plists

Listtable

Grouped

TextViewTabBar

Navigation

ImageView

Maps

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 !

UINavigationController

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

[navigation PopViewController];

[navigation Pop toViewController:];

Important Methods ?

Test Example ?UINavigationController

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

UITableView

[myTable reloadData]

[myTable reloadRowsAtIndexPaths: withRowAnimation:]

Important Methods ?

UITableView

didSelectRowAtIndexPath:(NSIndexPath *)indexPath

numberOfRowsInSection:(NSInteger)section{

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

cellForRowAtIndexPath:(NSIndexPath *)indexPath

Important Delegate Methods ?

Test Example ?UITableView

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 !

Test Example ?UITabBarView

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 !

UIWebView

(void)webViewDidFinishLoad:(UIWebView *)webView

(void)webViewDidStartLoad:(UIWebView *)webView

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

Important Delegate Methods ?

No More !

UIWebView

[self.webView loadRequest]

[self.webView loadHTMLString]

Important Methods ?

Test Example ?UIWebView

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 !

Test Example ?UITextView

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 !

UImageView

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

Important Methods ?

Test Example ?UIImageView

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 !

MKMapView

RegionWillChangeAnimated

RegionDidChangeAnimated

Important Methods ?

Tested Last lecture :)MKMapView

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 !

Tested it ?UIAlertView

Working With UserDefaults and Plists

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 !

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 !

Any Questions ?

Ready For The Project ?