iphone - Put a link on home screen of my app and connect it to WebView -


in app want put website's url on home screen , on clicking on want open webview. how should go this.

thanks,

previous commenter incorrect. can open hyperlink either externally safari or internally uiwebview.

add uiwebviewcontroller project. then, instantiate instance of uiwebviewcontroller shown inside app--you'll declaring property & synthesizing within main view controller (which need declared uiwebviewdelegate), such as:

@interface mymainviewcontroller: uiviewcontroller <uiwebviewdelegate> {     // implementation code here } 

when user taps button (assuming make button, rather text hyperlink), instruct app add uiwebview view stack, loading correct link. you'll want either within modal view or within navigation stack users can out of web view, of course.

in mymainviewcontroller implementation file, this:

-(void) showwebview {     // note: have not tested this, prototyping      // off top of head     uiwebview *mywebview = [[uiwebview alloc] init];     mywebview.delegate = self;     nsurl *homeurl = [[nsurl alloc] initwithstring:@"http://example.com"];     nsurlrequest *homerequest = [nsurlrequest requestwithurl:homeurl];     [mywebview loadrequest:homerequest];     [self.presentmodalviewcontroller: mywebview animated:yes];     // don't forget release objects when you're done     [mywebview release]; // etc. } 

now, off top of head know , have done. hope general idea. offer no warranty of kind here, guarantee entirely possible minimal headache. if stuck, check out developer references uiwebview. apple's docs top-notch & show great examples , running quickly.

best.


Comments

Popular posts from this blog

android - Spacing between the stars of a rating bar? -

aspxgridview - Devexpress grid - header filter does not work if column is initially hidden -

c# - How to execute a particular part of code asynchronously in a class -