IOS APPs Revision

  • View
    933

  • Download
    1

Embed Size (px)

DESCRIPTION

IOS Apps Revision

Transcript

  • 1. Final RevisionIOS Trackby Mohamed Amin

2. Agenda Main Components Covered during the Course UIImageView UINavigationController MKMapView UITableViewUIAlertView UITabBar Working WithUserDefaults and Plists UIWebView UITextView 3. Maps Navigation ListtableImageView GroupedTabBarTextView 4. UINavigationControllerHow to use it ? Define a property of UINavigation Controller Synthesize your propertyAdd this component to your Window As SubviewDrag and Drop your Component in Interface BuilderConnect your property to this ComponentNo More !Define your RootView xib and Class if you don`t haveone , Start to make a new View and make it as a root 5. UINavigationController Important Methods ?[PushViewController:(UIViewController) animated:(animated)];[navigation PopViewController];[navigation Pop toViewController:]; 6. UINavigationController Test Example ? 7. UITableView How to use it ?List table Create New View Controller with TableView Type Define your Data Source (Arrays or Dictionary or Something else) Define Table layout number of Sections and rowsGrouped table implement Delegate methods you will need like CellForRow , didSelectRowAtIndexPath and More No More ! 8. UITableViewImportant Methods ?[myTable reloadData][myTable reloadRowsAtIndexPaths: withRowAnimation:] 9. UITableViewImportant Delegate Methods ?didSelectRowAtIndexPath:(NSIndexPath *)indexPathnumberOfRowsInSection:(NSInteger)section{-(NSInteger)numberOfSectionsInTableView:(UITableView *)tableView{cellForRowAtIndexPath:(NSIndexPath *)indexPath 10. UITableView Test Example ? 11. UITabBarView How to use it ? Define a property of UITabBarControllerSynthesize your property Add this component to your Window As Subview Drag and Drop your Component in Interface Builder Connect your property to this ComponentDefine your First View and Second View xib and Class ifyou don`t have one , Start to make Views !!No More ! 12. UITabBarViewTest Example ? 13. UIWebViewHow to use it ?Define a property of UIWebView Synthesize your propertyDrag and Drop your Component in your View in Interface BuilderConnect your property to this ComponentStart to use it !! No More ! 14. UIWebViewImportant Delegate Methods ?(void)webViewDidFinishLoad:(UIWebView *)webView(void)webViewDidStartLoad:(UIWebView *)webView- (BOOL)webView:(UIWebView *)webView shouldStartLoadWithRequest:(NSURLRequest*)requestNo More ! 15. UIWebViewImportant Methods ?[self.webView loadRequest][self.webView loadHTMLString] 16. UIWebViewTest Example ? 17. UITextView How to use it ? Define a property of UITextView Synthesize your propertyDrag and Drop your Component in your View in Interface BuilderConnect your property to this ComponentStart to use it !! No More ! 18. UITextView Test Example ? 19. UIImageViewHow to use it ? Define a property of UIImageView Synthesize your propertyDrag and Drop your Component in your View in Interface BuilderSetYourImage using interface Builder OR using your CodeConnect your property to this ComponentStart to use it !! No More ! 20. UImageView Important Methods ?[self.imageView SetImage:[UIImage imageNamed: @image.png]]; 21. UIImageViewTest Example ? 22. MKMapViewHow to use it ?Define a property of MKMapView Synthesize your propertyDrag and Drop your Component in your View in Interface BuilderConnect your property to this ComponentStart to use it !! No More ! 23. MKMapView Important Methods ?RegionWillChangeAnimatedRegionDidChangeAnimated 24. MKMapViewTested Last lecture :) 25. UIAlertView How to use it ? UIAlertView *alert = [[UIAlertView alloc] initWithTitle:@No data yet! message:@No data has been received yet. delegate:nil cancelButtonTitle:nil otherButtonTitles:@OK, nil]; [alert show]; No More ! 26. UIAlertView Tested it ? 27. Working With UserDefaults and Plists 28. UserDefaults How to use it ? Definition:NSUserDefaults *defaults = [NSUserDefaults standardUserDefaults]; Usage- (void)setBool:(BOOL)value forKey:(NSString *)defaultName- (BOOL)boolForKey:(NSString *) defaultNameThe same setters and getters are found for string, arrays, integers and floats No More ! 29. Plists How to use it ?To 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];No More ! 30. Any Questions ? 31. Ready For The Project ?