Advertise Mobile SDKs Books Events Forum News Social Networking Support Us
Follow @iphonedevsdk on Twitter

Interface 2, Advanced iOS
Mockup & Code Gen
($9.99)

Make your own iPhone apps
and run them live!
(free)

Pic Frame Dynamo: Photo Editing
($0.99)

Abiliator
($1.99)

Want your application or service advertised on iPhone Dev SDK?

Go Back   iPhone Dev SDK Forum > iPhone SDK Development Forums > iPhone SDK Tutorials > Tutorial Discussion

Reply
 
LinkBack Thread Tools Display Modes
Old 05-26-2010, 06:16 AM   #1 (permalink)
Registered Member
 
Join Date: May 2010
Posts: 7
gyani is on a distinguished road
Question local website integration

Is there any way to integrate a local website within the iphone application so that it can be run without internet connection.???
if yes , Please tell me how to do .

Thanks
gyani is offline   Reply With Quote
Old 05-26-2010, 12:02 PM   #2 (permalink)
A Single-Serving Friend
 
Join Date: Mar 2010
Location: Groningen, NL
Posts: 491
Robert Paulson is on a distinguished road
Default

Yes, you can do that.

Create a new view controller and add a UIWebView to it. Then add the Website files to your project. Given that webView is an instance variable of your view controller, you can use

Code:
-(void) viewDidLoad {

	// Load the html file
	NSString *path = [[NSBundle mainBundle] pathForResource:@"index" ofType:@"html"];
	NSString *html = [NSString stringWithContentsOfFile:path encoding:NSUTF8StringEncoding error:nil];
	[self.webView loadHTMLString:html baseURL:[NSURL fileURLWithPath:[[NSBundle mainBundle]bundlePath]]];
}
Hope this helps.

Cheers,
Bob
__________________
We are God’s middle children, according to Tyler Durden, with no special place in history and no special attention.

Consider saying thanks by buying my app. :]
Robert Paulson is offline   Reply With Quote
Old 05-27-2010, 01:03 AM   #3 (permalink)
Registered Member
 
Join Date: May 2010
Posts: 7
gyani is on a distinguished road
Lightbulb

Quote:
Originally Posted by Robert Paulson View Post
Yes, you can do that.

Create a new view controller and add a UIWebView to it. Then add the Website files to your project. Given that webView is an instance variable of your view controller, you can use

Code:
-(void) viewDidLoad {

	// Load the html file
	NSString *path = [[NSBundle mainBundle] pathForResource:@"index" ofType:@"html"];
	NSString *html = [NSString stringWithContentsOfFile:path encoding:NSUTF8StringEncoding error:nil];
	[self.webView loadHTMLString:html baseURL:[NSURL fileURLWithPath:[[NSBundle mainBundle]bundlePath]]];
}
Hope this helps.

Cheers,
Bob
Thanks ,
By the help of that I have loaded the webpage but the href tag in the web page is not working.
gyani is offline   Reply With Quote
Reply

Bookmarks

Thread Tools
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
Trackbacks are On
Pingbacks are On
Refbacks are On



» Advertisements
» Stats
Members: 175,696
Threads: 94,139
Posts: 402,959
Top Poster: BrianSlick (7,990)
Welcome to our newest member, jasper_muc
Powered by vBadvanced CMPS v3.1.0

All times are GMT -5. The time now is 01:55 PM.
Powered by vBulletin® Version 3.8.0
Copyright ©2000 - 2012, Jelsoft Enterprises Ltd.
Search Engine Friendly URLs by vBSEO 3.3.0