how do i add html page in my iphone xcode project? -


can tell how add html in iphone project?? , no html option click on add new file in class group...why that???

simply create blank file , rename html or add existing html file project. next step depends on how wish use html file.

say if want load local file called page.html, first add file project,and in build phases of project, , page.html copy bundle resources, , run in app, writes file documents dictionary of app/

nsstring *html = [[nsstring alloc]initwithcontentsoffile:[[nsbundle mainbundle] pathforresource:@"page" oftype:@"html"] encoding:nsutf8stringencoding error:null]; [html writetofile:[[self docpath]stringbyappendingpathcomponent:@"page.html"] atomically:yes encoding:nsutf8stringencoding error:null]; [html release]; 

and webview should call load file:

nsarray *docpaths = nssearchpathfordirectoriesindomains(nsdocumentdirectory, nsuserdomainmask, yes); nsstring *docpath = [docpaths objectatindex:0]; [mywebview loadrequest:[nsurlrequest requestwithurl:[nsurl fileurlwithpath:[docpath stringbyappendingpathcomponent:@"page.html"]]]]; 

and it's done.


Comments

Popular posts from this blog

c# - How to set Z index when using WPF DrawingContext? -

razor - Is this a bug in WebMatrix PageData? -

visual c++ - Using relative values in array sorting ( asm ) -