Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/ios/119.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Ios UIActivityIndicator未显示的问题_Ios_Uiwebview_Indicator - Fatal编程技术网

Ios UIActivityIndicator未显示的问题

Ios UIActivityIndicator未显示的问题,ios,uiwebview,indicator,Ios,Uiwebview,Indicator,我正试图让我的应用程序通过UIWebView在dropbox上打开一个音乐文件。我已使用以下代码使音乐仅在单击时播放: -(IBAction)Play:(id)sender { NSString *stream = @"..."; NSURL *url = [NSURL URLWithString:stream]; NSURLRequest *urlrequest = [NSURLRequest requestWithURL:url]; [Webview loa

我正试图让我的应用程序通过UIWebView在dropbox上打开一个音乐文件。我已使用以下代码使音乐仅在单击时播放:

-(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];
}
我想添加一个指示器,在单击按钮后显示,直到quicktime播放器出现,以便通知用户按钮实际已被单击。我已使用以下代码完成此操作:

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

     else
         [activityIndicator startAnimating];

 }
但是,我有一个问题:点击按钮后,uiviewindicator就会消失!有人能帮我指出我做错了什么吗


提前感谢您

在您的游戏方法中取出:

[Webview addSubview: activityIndicator];

鉴于信息量有限,这很难回答。您使用的是XIB还是故事板?看起来您正在其他地方创建它,并将其添加到视图中。我的猜测是,您的网络视图模糊了活动指示器。您可能希望将活动指示器放在最前面,例如:[self-bringsubview tofront:activityIndicator]@NicholasHart我使用的是.xib,但是活动指示器不在webview后面,因为webview太小了,它不会显示在窗口中。无论如何谢谢你的帮助!:)阿卜杜拉·沙菲克解决了我的问题problem@DCB顺便说一下,如果你认为答案是好的,你可以给我加1分。