Re: Extract ID Value Into UILabel.
Re: Extract ID Value Into UILabel.
- Subject: Re: Extract ID Value Into UILabel.
- From: Jens Alfke <email@hidden>
- Date: Fri, 5 Feb 2010 08:52:52 -0800
On Feb 4, 2010, at 11:44 PM, Philip Juel Borges wrote:
> This code, HTMLverseLabel.text = [webView stringByEvaluatingJavaScriptFromString:@"document.title"]; extracts the title of any HTML file that is loaded in the UIWebView into a UILabel . So title becomes a general pointer that is only defined once.
You can also do this by accessing the DOM API directly from Objective-C, starting from the frame's DOMDocument. (But I'm not sure whether that API is available on iPhone.)
> The code, document.getElementById('1:1').id, extracts the id value 1:1 wherever that value occurs in my HTML files. But I'd rather not want to write 100s methods to extract each id value. So I'm thinking that there must be a way, in Objective-C, that you assign the numbers of this code, document.getElementById('1:1').id, a general pointer. I've tried replacing the numbers with %@ or %d but that doesn't work.
If I understand correctly, all you need to do is call [NSString stringWithFormat:...] to generate the right JavaScript expression.
—Jens_______________________________________________
Cocoa-dev mailing list (email@hidden)
Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden