I have these code:
Code:
-(void)actionSheet:(UIActionSheet *)actionSheet clickedButtonAtIndex:(NSInteger)buttonIndex
{
if (buttonIndex == 0)
{
NSString *query = [webAdress.text stringByReplacingOccurrencesOfString:@" " withString:@"+"];
[[UIApplication sharedApplication] openURL:[NSURL URLWithString:@"%@", query]];
}
if (buttonIndex == 1)
{
MFMailComposeViewController *composer = [[MFMailComposeViewController alloc] init];
composer.mailComposeDelegate = self;
if ([MFMailComposeViewController canSendMail]) {
NSString *query = [webAdress.text stringByReplacingOccurrencesOfString:@" " withString:@"+"];
[composer setSubject:@"Советую тебе посмотреть ссылку!"];
[composer setMessageBody:@"Смотри, что я нашел - %@", query isHTML:NO];
[self presentModalViewController:composer animated:YES];
}
}
}
-(void)mailComposeController:(MFMailComposeViewController *)controller didFinishWithResult:(MFMailComposeResult)result error:(NSError *)error
{
[self dismissModalViewControllerAnimated:YES];
if (result == MFMailComposeResultFailed) {
UIAlertView *alerl = [[UIAlertView alloc] initWithTitle:@"Не удалось отправить!" message:@"Не удалось отправить сообщение!" delegate:nil cancelButtonTitle:@"Хорошо" otherButtonTitles:nil];
[alerl show];
[alerl release];
}
}
And i need to get the page url from UITextField webAdress, from i load url, and put it to UIActionSheet buttons, that can create email with this link and open it in Safari.
To load the url to the uiwebview i use these code:
Code:
[_webView loadRequest:[NSURLRequest requestWithURL:[NSURL URLWithString:[webAdress text]]]];
Mine code didn't work...