Register FAQ / Rules Forum Spy Search Today's Posts Mark Forums Read
Go Back   MacRumors Forums > Apple Systems and Services > Programming > iPhone/iPad Programming

Reply
 
Thread Tools Search this Thread Display Modes
Old Aug 21, 2010, 11:51 PM   #1
newtoiphonesdk
macrumors 6502a
 
Join Date: Jul 2010
Get current URL from UIWebView

I have been trying to get this setup so that I can this pass it to a MailComposer to email the content from mywebview. I found a blog that said to use this
Code:
NSString *currentURL
= myWebView.request.URL.absoluteString;
However, it doesn't say where to implement this at, or how/where to declare it. In the view controller I have this code currently running for the webview.
Code:
- (void)awakeFromNib
{
	[sermons loadRequest:[NSURLRequest requestWithURL:[NSURL URLWithString:@"http://theipadpreacher.wordpress.com"]]];
	timer = [NSTimer scheduledTimerWithTimeInterval:(1.0/2.0) target:self selector:@selector(tick) userInfo:nil repeats:YES];
	
}
I'd Like to be able to set up an emailcomposer sheet so that I could email the contents of this from the app, and I don't know if I'm missing something simple, or if I need to completely rewrite the webview part of the code and where to put the code for getting the current url from the webview. Thanks
newtoiphonesdk is offline   0 Reply With Quote
Old Aug 22, 2010, 02:16 AM   #2
robbieduncan
Moderator
 
robbieduncan's Avatar
 
Join Date: Jul 2002
Location: London
The blog that you copied the code from (apparently without bothering to understand it) called the variable that points at their webview "myWebView". You appear to have called your "sermons". It should be clear what you need to change.
robbieduncan is offline   0 Reply With Quote
Old Aug 22, 2010, 04:15 AM   #3
robkwok
macrumors newbie
 
Join Date: Aug 2010
Quote:
Originally Posted by robbieduncan View Post
The blog that you copied the code from (apparently without bothering to understand it) called the variable that points at their webview "myWebView". You appear to have called your "sermons". It should be clear what you need to change.
right, so if you webview is called sermons, you just need to call sermons.request.URL.absoluteString to get the url string
robkwok is offline   0 Reply With Quote
Old Aug 22, 2010, 01:19 PM   #4
newtoiphonesdk
Thread Starter
macrumors 6502a
 
Join Date: Jul 2010
Quote:
Originally Posted by robbieduncan View Post
The blog that you copied the code from (apparently without bothering to understand it) called the variable that points at their webview "myWebView". You appear to have called your "sermons". It should be clear what you need to change.
The blog I got it from had nothing in it but that one line of code. It was called get current URL in the blog title and all the article had was that one line of code. Where do I put the code in? In the same awakefromnib line of code ?
newtoiphonesdk is offline   0 Reply With Quote
Old Aug 22, 2010, 03:27 PM   #5
robbieduncan
Moderator
 
robbieduncan's Avatar
 
Join Date: Jul 2002
Location: London
Quote:
Originally Posted by newtoiphonesdk View Post
The blog I got it from had nothing in it but that one line of code. It was called get current URL in the blog title and all the article had was that one line of code. Where do I put the code in? In the same awakefromnib line of code ?
Wherever it makes sense. Think about it. If you put it in awakefromnib you'll get the URL at that point in time. Which sounds wrong to me.
robbieduncan is offline   0 Reply With Quote
Old Aug 22, 2010, 06:34 PM   #6
Anne R. Kist
macrumors newbie
 
Join Date: Aug 2010
Location: ...in the UK
Quote:
Originally Posted by newtoiphonesdk View Post
Where do I put the code in? In the same awakefromnib line of code ?
awakefromnib sounds like an excellent place to put it. Don't forget to do a [sermons release] before to free up any extra memory that sermons might be using.
Anne R. Kist is offline   0 Reply With Quote

Reply
MacRumors Forums > Apple Systems and Services > Programming > iPhone/iPad Programming

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump

Similar Threads
thread Thread Starter Forum Replies Last Post
Getting Information from XML and displaying it on a UIWebView ashwinr87 iPhone/iPad Programming 1 Oct 3, 2011 02:24 PM
Getting link URLs from WebView Thethuthinang Mac Programming 3 Jan 17, 2011 06:53 PM
Open url in UIWebView + NSString guydor4 iPhone/iPad Programming 2 Nov 6, 2009 09:04 AM
UIWebView getting current URL dusker iPhone/iPad Programming 0 Jul 14, 2009 10:42 AM
Sending URL to UIWebView matthew858 iPhone/iPad Programming 1 Sep 27, 2008 02:36 AM


All times are GMT -5. The time now is 05:32 PM.

Mac Rumors | Mac | iPhone | iPhone Game Reviews | iPhone Apps

Mobile Version | Fixed | Fluid | Fluid HD
Copyright 2002-2013, MacRumors.com, LLC