<?xml version="1.0" encoding="UTF-8"?><rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
		>
<channel>
	<title>Comments on: Search and highlight text in UIWebView</title>
	<atom:link href="http://www.icab.de/blog/2010/01/12/search-and-highlight-text-in-uiwebview/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.icab.de/blog/2010/01/12/search-and-highlight-text-in-uiwebview/</link>
	<description>iCab related stuff; Mac, iPhone and Cocoa programming</description>
	<lastBuildDate>Wed, 08 Sep 2010 08:38:17 +0000</lastBuildDate>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.0.1</generator>
	<item>
		<title>By: dRine</title>
		<link>http://www.icab.de/blog/2010/01/12/search-and-highlight-text-in-uiwebview/comment-page-2/#comment-4088</link>
		<dc:creator>dRine</dc:creator>
		<pubDate>Wed, 08 Sep 2010 08:38:17 +0000</pubDate>
		<guid isPermaLink="false">http://www.icab.de/blog/?p=110#comment-4088</guid>
		<description>Thank you so much ! 
I&#039;ve read it was something like that on the apple developer forum but the solutions were wrong. Instead, YOU are totally right !
Thanks for your quick answer !!</description>
		<content:encoded><![CDATA[<p>Thank you so much !<br />
I&#8217;ve read it was something like that on the apple developer forum but the solutions were wrong. Instead, YOU are totally right !<br />
Thanks for your quick answer !!</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Alexander</title>
		<link>http://www.icab.de/blog/2010/01/12/search-and-highlight-text-in-uiwebview/comment-page-2/#comment-4087</link>
		<dc:creator>Alexander</dc:creator>
		<pubDate>Wed, 08 Sep 2010 08:21:00 +0000</pubDate>
		<guid isPermaLink="false">http://www.icab.de/blog/?p=110#comment-4087</guid>
		<description>@dRine

Probably, Xcode does not treat the .js file as resource file. And so it tries to compile it instead of copying it into as resource into the app bundle.

To fix this, look into the sidebar of the project window in XCode and locate the section &quot;targets&quot;. Here you should move the .js file from &quot;compile source&quot; to &quot;copy bundle resources&quot; section.</description>
		<content:encoded><![CDATA[<p>@dRine</p>
<p>Probably, Xcode does not treat the .js file as resource file. And so it tries to compile it instead of copying it into as resource into the app bundle.</p>
<p>To fix this, look into the sidebar of the project window in XCode and locate the section &#8220;targets&#8221;. Here you should move the .js file from &#8220;compile source&#8221; to &#8220;copy bundle resources&#8221; section.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: dRine</title>
		<link>http://www.icab.de/blog/2010/01/12/search-and-highlight-text-in-uiwebview/comment-page-2/#comment-4086</link>
		<dc:creator>dRine</dc:creator>
		<pubDate>Wed, 08 Sep 2010 07:53:13 +0000</pubDate>
		<guid isPermaLink="false">http://www.icab.de/blog/?p=110#comment-4086</guid>
		<description>Hi,
Very helpful post, thanks a lot !
Unfortunately, I&#039;ve got a little problem with it. If I put some javascript directly in my Objective-C code, no problem. But now, I&#039;ve put some more complex code in a .js file. The problem is that the mainBundle can&#039;t find it. I&#039;ve put my .js file in my Resources folder. I&#039;ve also tried with a .txt. I really don&#039;t understand.
Have you an idea of what the problem is ?
thanks a lot !</description>
		<content:encoded><![CDATA[<p>Hi,<br />
Very helpful post, thanks a lot !<br />
Unfortunately, I&#8217;ve got a little problem with it. If I put some javascript directly in my Objective-C code, no problem. But now, I&#8217;ve put some more complex code in a .js file. The problem is that the mainBundle can&#8217;t find it. I&#8217;ve put my .js file in my Resources folder. I&#8217;ve also tried with a .txt. I really don&#8217;t understand.<br />
Have you an idea of what the problem is ?<br />
thanks a lot !</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Alexander</title>
		<link>http://www.icab.de/blog/2010/01/12/search-and-highlight-text-in-uiwebview/comment-page-2/#comment-3780</link>
		<dc:creator>Alexander</dc:creator>
		<pubDate>Fri, 13 Aug 2010 19:24:05 +0000</pubDate>
		<guid isPermaLink="false">http://www.icab.de/blog/?p=110#comment-3780</guid>
		<description>@Fabio
The delegate method &quot;viewDidFinishLoad:&quot; is the right place to inject your JavaScript code. But you have to use the &quot;setDelegate:&quot; method of the UIWebView object first to set the object which implements this &quot;viewDidFinishLoad:&quot; method. If you donÄ&#039;t set the delegate, the delegate method is not called.
And you have to use the method &quot;stringByEvaluatingJavaScriptFromString:&quot; of UIWebView to execute JavaScript code. Here you can pass any Javascript code to the UIWebView.</description>
		<content:encoded><![CDATA[<p>@Fabio<br />
The delegate method &#8220;viewDidFinishLoad:&#8221; is the right place to inject your JavaScript code. But you have to use the &#8220;setDelegate:&#8221; method of the UIWebView object first to set the object which implements this &#8220;viewDidFinishLoad:&#8221; method. If you donÄ&#8217;t set the delegate, the delegate method is not called.<br />
And you have to use the method &#8220;stringByEvaluatingJavaScriptFromString:&#8221; of UIWebView to execute JavaScript code. Here you can pass any Javascript code to the UIWebView.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Fabio</title>
		<link>http://www.icab.de/blog/2010/01/12/search-and-highlight-text-in-uiwebview/comment-page-2/#comment-3779</link>
		<dc:creator>Fabio</dc:creator>
		<pubDate>Fri, 13 Aug 2010 19:10:35 +0000</pubDate>
		<guid isPermaLink="false">http://www.icab.de/blog/?p=110#comment-3779</guid>
		<description>Alexander, i thank you anticipately, but how i could manage the

[webView loadRequest:requestObj];

like in java(i come from it) 

UiWebView view= webView.loadRequest(requestObj);
view.injectSomeJs(myjs);
view.show();

how it could be done(if it&#039;s not so much complicated) ;-)
actually, i load my webView on 
-(void)viewDidLoad{..}

i tried to put the code  snippets you suggested on
- (void)viewDidFinishLoad:(UIWebView *)webView {...}

but the debug never reach this point :-( any suggestion?</description>
		<content:encoded><![CDATA[<p>Alexander, i thank you anticipately, but how i could manage the</p>
<p>[webView loadRequest:requestObj];</p>
<p>like in java(i come from it) </p>
<p>UiWebView view= webView.loadRequest(requestObj);<br />
view.injectSomeJs(myjs);<br />
view.show();</p>
<p>how it could be done(if it&#8217;s not so much complicated) <img src='http://www.icab.de/blog/wp-includes/images/smilies/icon_wink.gif' alt=';-)' class='wp-smiley' /><br />
actually, i load my webView on<br />
-(void)viewDidLoad{..}</p>
<p>i tried to put the code  snippets you suggested on<br />
- (void)viewDidFinishLoad:(UIWebView *)webView {&#8230;}</p>
<p>but the debug never reach this point <img src='http://www.icab.de/blog/wp-includes/images/smilies/icon_sad.gif' alt=':-(' class='wp-smiley' />  any suggestion?</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Alexander</title>
		<link>http://www.icab.de/blog/2010/01/12/search-and-highlight-text-in-uiwebview/comment-page-2/#comment-3778</link>
		<dc:creator>Alexander</dc:creator>
		<pubDate>Fri, 13 Aug 2010 18:47:36 +0000</pubDate>
		<guid isPermaLink="false">http://www.icab.de/blog/?p=110#comment-3778</guid>
		<description>@Fabio
Yes, you can inject JavaScript code with new StyleSheets. But this can be only done after the page is loaded,  so the page will load and display with the original stylesheets first before you can set the new stylesheets.</description>
		<content:encoded><![CDATA[<p>@Fabio<br />
Yes, you can inject JavaScript code with new StyleSheets. But this can be only done after the page is loaded,  so the page will load and display with the original stylesheets first before you can set the new stylesheets.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Fabio</title>
		<link>http://www.icab.de/blog/2010/01/12/search-and-highlight-text-in-uiwebview/comment-page-2/#comment-3777</link>
		<dc:creator>Fabio</dc:creator>
		<pubDate>Fri, 13 Aug 2010 17:13:05 +0000</pubDate>
		<guid isPermaLink="false">http://www.icab.de/blog/?p=110#comment-3777</guid>
		<description>Hi Alexander

i had a problem, i need to load a custom css on a uiwebview

NSURL *url = [NSURL URLWithString:indirizzo];
NSURLRequest *requestObj = [NSURLRequest requestWithURL:url];	
[webView loadRequest:requestObj];

i must style the page via the css after i loaded it. You think it&#039;s possible to inject javascript with my css rules, and finally show the webpage modified?
Thanks for your help!</description>
		<content:encoded><![CDATA[<p>Hi Alexander</p>
<p>i had a problem, i need to load a custom css on a uiwebview</p>
<p>NSURL *url = [NSURL URLWithString:indirizzo];<br />
NSURLRequest *requestObj = [NSURLRequest requestWithURL:url];<br />
[webView loadRequest:requestObj];</p>
<p>i must style the page via the css after i loaded it. You think it&#8217;s possible to inject javascript with my css rules, and finally show the webpage modified?<br />
Thanks for your help!</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Ryan</title>
		<link>http://www.icab.de/blog/2010/01/12/search-and-highlight-text-in-uiwebview/comment-page-2/#comment-3697</link>
		<dc:creator>Ryan</dc:creator>
		<pubDate>Thu, 05 Aug 2010 18:31:57 +0000</pubDate>
		<guid isPermaLink="false">http://www.icab.de/blog/?p=110#comment-3697</guid>
		<description>It worked!  I had to brush up on what is meant to call a delegate method, but after that it was pretty straight forward.  

Thanks for your help Alexander!</description>
		<content:encoded><![CDATA[<p>It worked!  I had to brush up on what is meant to call a delegate method, but after that it was pretty straight forward.  </p>
<p>Thanks for your help Alexander!</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Alexander</title>
		<link>http://www.icab.de/blog/2010/01/12/search-and-highlight-text-in-uiwebview/comment-page-2/#comment-3687</link>
		<dc:creator>Alexander</dc:creator>
		<pubDate>Wed, 04 Aug 2010 20:35:17 +0000</pubDate>
		<guid isPermaLink="false">http://www.icab.de/blog/?p=110#comment-3687</guid>
		<description>@Ryan and others who have the same issue

Please make sure that you call &quot;highlightAllOccurencesOfString:&quot; after the page is completely loaded and rendered. If you call it too early, the HTML code is not yet rendered and so the script won&#039;t be able to find anything. So at least you have to wait until the UIWebView delegate &quot;webViewDidFinishLoad:&quot; is called.</description>
		<content:encoded><![CDATA[<p>@Ryan and others who have the same issue</p>
<p>Please make sure that you call &#8220;highlightAllOccurencesOfString:&#8221; after the page is completely loaded and rendered. If you call it too early, the HTML code is not yet rendered and so the script won&#8217;t be able to find anything. So at least you have to wait until the UIWebView delegate &#8220;webViewDidFinishLoad:&#8221; is called.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Alexander</title>
		<link>http://www.icab.de/blog/2010/01/12/search-and-highlight-text-in-uiwebview/comment-page-2/#comment-3670</link>
		<dc:creator>Alexander</dc:creator>
		<pubDate>Tue, 03 Aug 2010 16:26:40 +0000</pubDate>
		<guid isPermaLink="false">http://www.icab.de/blog/?p=110#comment-3670</guid>
		<description>@Ryan
Could you create a simple text project where this issue can be seen and then send it to me or post a link to the project? The above code works in my projects, so I would need to check this myself in order to help.</description>
		<content:encoded><![CDATA[<p>@Ryan<br />
Could you create a simple text project where this issue can be seen and then send it to me or post a link to the project? The above code works in my projects, so I would need to check this myself in order to help.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Ryan</title>
		<link>http://www.icab.de/blog/2010/01/12/search-and-highlight-text-in-uiwebview/comment-page-2/#comment-3669</link>
		<dc:creator>Ryan</dc:creator>
		<pubDate>Tue, 03 Aug 2010 15:37:18 +0000</pubDate>
		<guid isPermaLink="false">http://www.icab.de/blog/?p=110#comment-3669</guid>
		<description>Hi Alexander,

Thank you for putting this page together.  I have a question though.

I am having the same problem as @Siddu.  I cannot get the javascript to execute inside the &quot;if (element.nodeType == 3)&quot; statement.  I would like to do a simple search for text in an html script that I created and displayed in the UIWebview.  For example, I may display a string defined by the following html:

@&quot;The Meaning of Life ... really is &lt;b&gt;42&lt;/b&gt;!&quot;

the search for the string &quot;Life&quot;

Any ideas on why MyApp_SearchResultCount shows up as 0?  Thank you kindly.

-Ryan</description>
		<content:encoded><![CDATA[<p>Hi Alexander,</p>
<p>Thank you for putting this page together.  I have a question though.</p>
<p>I am having the same problem as @Siddu.  I cannot get the javascript to execute inside the &#8220;if (element.nodeType == 3)&#8221; statement.  I would like to do a simple search for text in an html script that I created and displayed in the UIWebview.  For example, I may display a string defined by the following html:</p>
<p>@&#8221;The Meaning of Life &#8230; really is <b>42</b>!&#8221;</p>
<p>the search for the string &#8220;Life&#8221;</p>
<p>Any ideas on why MyApp_SearchResultCount shows up as 0?  Thank you kindly.</p>
<p>-Ryan</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Kalibannez</title>
		<link>http://www.icab.de/blog/2010/01/12/search-and-highlight-text-in-uiwebview/comment-page-2/#comment-3661</link>
		<dc:creator>Kalibannez</dc:creator>
		<pubDate>Mon, 02 Aug 2010 23:37:11 +0000</pubDate>
		<guid isPermaLink="false">http://www.icab.de/blog/?p=110#comment-3661</guid>
		<description>Thank you, Alexander!
Great note!</description>
		<content:encoded><![CDATA[<p>Thank you, Alexander!<br />
Great note!</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: physical therapist</title>
		<link>http://www.icab.de/blog/2010/01/12/search-and-highlight-text-in-uiwebview/comment-page-2/#comment-3626</link>
		<dc:creator>physical therapist</dc:creator>
		<pubDate>Thu, 29 Jul 2010 22:46:57 +0000</pubDate>
		<guid isPermaLink="false">http://www.icab.de/blog/?p=110#comment-3626</guid>
		<description>this post is very usefull thx!</description>
		<content:encoded><![CDATA[<p>this post is very usefull thx!</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Aloha Silver</title>
		<link>http://www.icab.de/blog/2010/01/12/search-and-highlight-text-in-uiwebview/comment-page-2/#comment-3555</link>
		<dc:creator>Aloha Silver</dc:creator>
		<pubDate>Wed, 21 Jul 2010 15:30:58 +0000</pubDate>
		<guid isPermaLink="false">http://www.icab.de/blog/?p=110#comment-3555</guid>
		<description>Alexander, using the semicolon works!

I just need to understand HTML nodes better before successfully implementing my idea now.

Thanks a lot!</description>
		<content:encoded><![CDATA[<p>Alexander, using the semicolon works!</p>
<p>I just need to understand HTML nodes better before successfully implementing my idea now.</p>
<p>Thanks a lot!</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Marie</title>
		<link>http://www.icab.de/blog/2010/01/12/search-and-highlight-text-in-uiwebview/comment-page-2/#comment-3538</link>
		<dc:creator>Marie</dc:creator>
		<pubDate>Mon, 19 Jul 2010 19:55:22 +0000</pubDate>
		<guid isPermaLink="false">http://www.icab.de/blog/?p=110#comment-3538</guid>
		<description>Oh! never mind! it was a problem with the UIWebView...thanks! It works perfectly! :)</description>
		<content:encoded><![CDATA[<p>Oh! never mind! it was a problem with the UIWebView&#8230;thanks! It works perfectly! <img src='http://www.icab.de/blog/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /> </p>
]]></content:encoded>
	</item>
</channel>
</rss>
