Don't like ads? PRO users don't see any ads ;-)
Guest

Untitled

By: a guest on May 28th, 2012  |  syntax: None  |  size: 2.24 KB  |  hits: 11  |  expires: Never
download  |  raw  |  embed  |  report abuse  |  print
Text below is selected. Please press Ctrl+C to copy to your clipboard. (⌘+C on Mac)
  1. @implementation taskTwoViewController
  2.  
  3. -(void)viewDidLoad
  4. {
  5.         [buttonMail setTitle:NSLocalizedString(@"Mail",@"") forState:UIControlStateNormal];
  6.         [buttonMap setTitle:NSLocalizedString(@"Map",@"") forState:UIControlStateNormal];
  7.         [buttonBrouzer setTitle:NSLocalizedString(@"Brouzer",@"") forState:UIControlStateNormal];
  8.         if ([MFMailComposeViewController canSendMail])
  9.                 buttonMail.enabled = YES;
  10. }
  11.  
  12. -(IBAction)mailIt
  13. {
  14.         MFMailComposeViewController *mailController = [[MFMailComposeViewController alloc] init];
  15.         mailController.mailComposeDelegate = self;
  16.         [mailController setSubject:@"blah"];
  17.         [mailController setMessageBody:@"blah" isHTML:NO];
  18.         [self presentModalViewController:mailController animated:YES];
  19.         [mailController release];
  20. }
  21.  
  22. - (void)mailComposeController:(MFMailComposeViewController*)controller didFinishWithResult:(MFMailComposeResult)result error:(NSError*)error {
  23.         [self becomeFirstResponder];
  24.         [self dismissModalViewControllerAnimated:YES];
  25. }
  26.  
  27. -(IBAction)mapIt
  28. {
  29.         MKMapView *mapController = [[MKMapView alloc] initWithFrame:CGRectMake(0.0,70.0,self.view.frame.size.width,self.view.frame.size.height)];        
  30.         MKCoordinateSpan span;
  31.         span.latitudeDelta=0.3;
  32.         span.longitudeDelta=0.3;
  33.         CLLocationCoordinate2D coordinates;
  34.         coordinates.latitude=48.5;
  35.         coordinates.longitude=35.1;
  36.         MKCoordinateRegion region;
  37.         region.span = span;
  38.         region.center = coordinates;
  39.         [mapController setRegion:region animated:TRUE];
  40.         [mapController regionThatFits:region];
  41.         [self.view insertSubview:mapController atIndex:1];
  42.         [mapController release];
  43. }
  44.  
  45. -(IBAction)brouzerIt
  46. {        
  47.         UIWebView *webController = [[UIWebView alloc] initWithFrame:CGRectMake(0.0,70.0,self.view.frame.size.width,self.view.frame.size.height)];        
  48.         NSString *urlAddress = @"http://www.gorod.dp.ua";
  49.         NSURL *url = [NSURL URLWithString:urlAddress];
  50.         NSURLRequest *requestObj = [NSURLRequest requestWithURL:url];
  51.         [webController loadRequest:requestObj];
  52.         [self.view addSubview:webController];
  53.         [webController release];
  54. }