0

Brand new to app coding-- hope you can help!

I'm using XCode 4.3 with Storyboard.

I have a UIWebView inside a tabbed UIview that loads an .mp3 file and plays it when that tab is selected. What I'd like, however, is to have the WebView sit idle when the tab is displayed, then only load once the user has pressed a "Load" button.

(Also, I've linked the "Load" button already as a Reload in Storyboard, so I guess I really would just like to know how to make UIWebView not load the first time?)

Here is my code atm:

@implementation FirstViewController
@synthesize webView;


- (void)viewDidLoad
{
[super viewDidLoad];
[webView loadRequest:[NSURLRequest
    requestWithURL:[NSURL URLWithString:
    @"http://mysite.com/test.mp3"]]]
    ;
// Do any additional setup after loading the view, typically from a nib.
}

- (void)viewDidUnload
{
    webView = nil;
    [super viewDidUnload];
// Release any retained subviews of the main view.
}

- (BOOL)shouldAutorotateToInterfaceOrientation:    (UIInterfaceOrientation)interfaceOrientation
{
    return (interfaceOrientation != UIInterfaceOrientationPortraitUpsideDown);
}

@end

Thanks so much for any help!

Homeoftheben
  • 69
  • 1
  • 10
  • Went back and worked a little longer-- what I'm doing now is opening a new UIView when the button is clicked, and loading the UIWebview inside of that. Not extremely elegant, but works for the time being. – Homeoftheben May 11 '12 at 20:21

2 Answers2

0

Use this syntax at your back button. webview.goBack;

Juli
  • 16
  • 4
0

Add webview delegate to your .h file and then in he implemetation file that is in .m file add the webview delegate method, and there in finished loading write the code for stop loading.

  • (void)webViewDidFinishLoad:(UIWebView *)webView{

    [progressBar stopAnimating]; [progressBar setHidden:YES]; [webvwFbLike setHidden:NO]; }

Juli
  • 16
  • 4