MKMapView Delegate
- (MKAnnotationView *)mapView:(MKMapView *)theMapView viewForAnnotation:(id <MKAnnotation>)annotation;
-(void)mapView:(MKMapView *)mapView annotationView:(MKPinAnnotationView *)view calloutAccessoryControlTapped:(UIControl *)control ;
UIWebView Delegate
- (BOOL)webView:(UIWebView *)webView shouldStartLoadWithRequest:(NSURLRequest *)request navigationType:(UIWebViewNavigationType)navigationType;
- (void)webViewDidStartLoad:(UIWebView *)webView;
- (void)webViewDidFinishLoad:(UIWebView *)webView;
UISearchBar Delegate
- (void)searchBarTextDidBeginEditing:(UISearchBar *)searchB ;
- (void)searchBar:(UISearchBar *)searchB textDidChange:(NSString *)searchText ;
- (void)searchBarSearchButtonClicked:(UISearchBar *)searchB ;
- (void)searchBarCancelButtonClicked:(UISearchBar *)searchB;
UIActionSheet Delegate and UIAlertView Delegate
- (void)alertView:(UIAlertView *)alertView clickedButtonAtIndex:(NSInteger)buttonIndex;
-(void)actionSheet:(UIActionSheet *)actionSheet clickedButtonAtIndex:(NSInteger)buttonIndex ;
MFMailComposeViewControllerDelegate with code:
// Displays an email composition interface inside the application. Populates all the Mail fields.
-(void)displayMailComposerSheet
{
MFMailComposeViewController *picker = [[[MFMailComposeViewController alloc] init] autorelease];
picker.mailComposeDelegate = self;
if([MFMailComposeViewController canSendMail])
{
[picker setSubject:@"Near2Me iPhone App Feedback"];
NSString *emailBody =@"";
[picker setToRecipients:[NSArray arrayWithObjects:@"xyz444&6@gmail.com",nil]];
[picker setMessageBody:emailBody isHTML:NO];
[self.homeView presentModalViewController:picker animated:YES];
}
}
//
Dismisses the email composition interface when users tap Cancel or
Send. Proceeds to update the message field with the result of the
operation.
- (void)mailComposeController:(MFMailComposeViewController*)controller didFinishWithResult:(MFMailComposeResult)result error:(NSError*)error
{
// Notifies users about errors associated with the interface
switch (result)
{
case MFMailComposeResultCancelled:
NSLog(@"Result: canceled");
break;
case MFMailComposeResultSaved:
NSLog(@"Result: Saved");
break;
case MFMailComposeResultSent:
if (MFMailComposeResultSent)
{
UIAlertView *alert = [[UIAlertView alloc]initWithTitle:@"Near2Me Team"
message:@"Thanks for your feedback. We always try to make application more simpler and accurate."
delegate:nil
cancelButtonTitle:@"OK"
otherButtonTitles:nil];
[alert show];
[alert release];
}
NSLog(@"Result: Sent");
break;
case MFMailComposeResultFailed:
NSLog(@"Result: failed");
break;
default:
NSLog(@"Result: not Send");
break;
}
[self.homeView dismissModalViewControllerAnimated:YES];
//[appDeleg.window addSubview:appDeleg.viewMenuTab];
}
UINavigationController
homeView = [[HomeViewController alloc]initWithNibName:@"HomeViewController" bundle:[NSBundle mainBundle]];
navigation = [[UINavigationController alloc]initWithRootViewController:homeView];
[self.window setBackgroundColor:BGCOLOR];
[self.window addSubview:navigation.view];
// hiding - show navigationController setToolbar
[self.navigationController setToolbarHidden:YES animated:NO];
UITabBarController
self.window = [[[UIWindow alloc] initWithFrame:[[UIScreen mainScreen] bounds]] autorelease];
UIViewController *viewController1 = [[[FirstViewController alloc] initWithNibName:@"FirstViewController" bundle:nil] autorelease];
UIViewController *viewController2 = [[[SecondViewController alloc] initWithNibName:@"SecondViewController" bundle:nil] autorelease];
tabBarController = [[[UITabBarController alloc] init] autorelease];
tabBarController.viewControllers = [NSArray arrayWithObjects:viewController1, viewController2, nil];
self.window.rootViewController = self.tabBarController;
NSXMLParser
Parsing the start of an element
- (void)parser:(NSXMLParser *)parser didStartElement:(NSString *)elementName
namespaceURI:(NSString *)namespaceURI qualifiedName:(NSString *)qualifiedName
attributes:(NSDictionary *)attributeDict ;
Parsing an element’s value
- (void)parser:(NSXMLParser *)parser foundCharacters:(NSString *)string;
Parsing the end of an element//XMLParser.m
- (void)parser:(NSXMLParser *)parser didEndElement:(NSString *)elementName
namespaceURI:(NSString *)namespaceURI qualifiedName:(NSString *)qName {
UIPickerView Delegates
- (NSInteger)pickerView:(UIPickerView *)thePickerView numberOfRowsInComponent:(NSInteger)component {
return [arrayColors count];
}
- (NSString *)pickerView:(UIPickerView *)thePickerView titleForRow:(NSInteger)row forComponent:(NSInteger)component {
return [arrayColors objectAtIndex:row];
}
- (void)pickerView:(UIPickerView *)thePickerView didSelectRow:(NSInteger)row inComponent:(NSInteger)component {
NSLog(@"Selected Color: %@. Index of selected color: %i", [arrayColors objectAtIndex:row], row);
}