Hello David,
                  This is the piece of code from where I access the html
files locally, but I am not able to view anything on the iphone web
browser can you let me know where I am going wrong.I have the local html
file in the same folder as the project folder on which I am working on.
 
 
protected void NavigateToUrl()
{
string url = this.txtAddress.Text;
    
NSBundle.MainBundle.PathForResource("CliqueITSample.html","html");
this.webMain.LoadRequest (new NSUrlRequest(NSUrl.FromFilename(url)));
}
 
 
Thanks,
Pratheek

________________________________

From: [email protected] [mailto:[email protected]] On Behalf Of
David Moles
Sent: Wednesday, July 06, 2011 11:41 AM
To: Pratheek Katangur
Cc: [email protected]
Subject: Re: [MonoTouch] Help with the code snippet


Hi Pratheek -- 

It looks like you've got something like a mix of C# and Objective-C code
there. In C# it would look more like:

this.webMain.LoadRequest(new NSUrlRequest(NSUrl.FromFilename(...));

As far as the file path, (the ... above), I haven't tried using the NS
resource stuff at all; I just mark my html files with the "content"
build action and use paths relative to the project root.

But, if the resource stuff works, the method you're trying to call would
look like:

NSBundle.MainBundle.PathForResource("cliqueitsample", "html");

It takes some time to get used to translating Objective-C examples into
C# for Monotouch, and the mapping isn't always intuitive. You might want
to have a look at Miguel de Icaza's "Monotouch Rosetta Stone
<http://tirania.org/tmp/rosetta.html> " to get a feel for it.

Best,
David

On Wed, Jul 6, 2011 at 8:26 AM, Pratheek Katangur
<[email protected]> wrote:


        
        Hello,
                I developed a project in mono develop which is required
to display html files on the web browser.I am able to display remote
html files and html files sitting on a local web server.Now I want to
display local html files on the web browser.I could find a code snippet
online for the same but I am not able to compile it successfully.Can you
help me out whether there is any problem with the code syntatically .
        Here is the piece of code:
         
        
        this.webMain.LoadRequest(NSUrlRequest requestWithUrl(NSUrl
firleUrlWithPath(NSBundle mainBundle)pathForResource:@"cliqueitsample"
ofType:@"html")isDirectory:No)));
         
         
         
        Thanks in Advance,
        Pratheek

        _______________________________________________
        MonoTouch mailing list
        [email protected]
        http://lists.ximian.com/mailman/listinfo/monotouch
        
        




-- 
David Moles 
[email protected]

_______________________________________________
MonoTouch mailing list
[email protected]
http://lists.ximian.com/mailman/listinfo/monotouch

Reply via email to