Question

I am trying to make my application open a musicfile on dropbox thru UIWebView. I have made the music play only on click with the following code:

-(IBAction)Play:(id)sender {

    NSString *stream = @"...";
    NSURL *url = [NSURL URLWithString:stream];
    NSURLRequest *urlrequest = [NSURLRequest requestWithURL:url];
    [Webview loadRequest:urlrequest];
    [Webview addSubview: activityIndicator];

    timer = [NSTimer scheduledTimerWithTimeInterval:(1.0/2.0) target:self selector:@selector(loading) userInfo:nil repeats:YES];
}

I want to add an indicator to show up after the button is clicked till the quicktime player appears so to notify the user that the button has actually been clicked. I have done this with the following code:

-(void)loading {
     if (!Webview.loading)
         [activityIndicator stopAnimating];

     else
         [activityIndicator startAnimating];

 }

However, i have a problem: the uiviewindicator disappears one the button has been clicked! Could someone help me and point out what I am doing wrong?

Thank you in advance

Was it helpful?

Solution

In your play method take out:

[Webview addSubview: activityIndicator];
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top