- @implementation taskTwoViewController
- -(void)viewDidLoad
- {
- [buttonMail setTitle:NSLocalizedString(@"Mail",@"") forState:UIControlStateNormal];
- [buttonMap setTitle:NSLocalizedString(@"Map",@"") forState:UIControlStateNormal];
- [buttonBrouzer setTitle:NSLocalizedString(@"Brouzer",@"") forState:UIControlStateNormal];
- if ([MFMailComposeViewController canSendMail])
- buttonMail.enabled = YES;
- }
- -(IBAction)mailIt
- {
- MFMailComposeViewController *mailController = [[MFMailComposeViewController alloc] init];
- mailController.mailComposeDelegate = self;
- [mailController setSubject:@"blah"];
- [mailController setMessageBody:@"blah" isHTML:NO];
- [self presentModalViewController:mailController animated:YES];
- [mailController release];
- }
- - (void)mailComposeController:(MFMailComposeViewController*)controller didFinishWithResult:(MFMailComposeResult)result error:(NSError*)error {
- [self becomeFirstResponder];
- [self dismissModalViewControllerAnimated:YES];
- }
- -(IBAction)mapIt
- {
- MKMapView *mapController = [[MKMapView alloc] initWithFrame:CGRectMake(0.0,70.0,self.view.frame.size.width,self.view.frame.size.height)];
- MKCoordinateSpan span;
- span.latitudeDelta=0.3;
- span.longitudeDelta=0.3;
- CLLocationCoordinate2D coordinates;
- coordinates.latitude=48.5;
- coordinates.longitude=35.1;
- MKCoordinateRegion region;
- region.span = span;
- region.center = coordinates;
- [mapController setRegion:region animated:TRUE];
- [mapController regionThatFits:region];
- [self.view insertSubview:mapController atIndex:1];
- [mapController release];
- }
- -(IBAction)brouzerIt
- {
- UIWebView *webController = [[UIWebView alloc] initWithFrame:CGRectMake(0.0,70.0,self.view.frame.size.width,self.view.frame.size.height)];
- NSString *urlAddress = @"http://www.gorod.dp.ua";
- NSURL *url = [NSURL URLWithString:urlAddress];
- NSURLRequest *requestObj = [NSURLRequest requestWithURL:url];
- [webController loadRequest:requestObj];
- [self.view addSubview:webController];
- [webController release];
- }