iOS,UIActivityIndi​​cator永远不会显示在推送的Web视图控制器中

时间:2014-09-18 13:06:08

标签: ios objective-c ios7

我试图在加载请求的URL之前显示并启动UIActivityIndi​​cator到webView中...并在加载后停止它 但它永远不会显示....

-(void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath
{
     NSDictionary *dict = [self.arrNewsData objectAtIndex:indexPath.row];

     NSString *newsLink = [dict objectForKey:@"link"];

     // setup the controller to be pushed
     UIViewController *webViewController = [[UIViewController alloc] init];
     webViewController.title = @"Article";

     // setu p the web view
     UIWebView *webView = [[UIWebView alloc] initWithFrame:CGRectMake(0, 0, self.view.frame.size.width, self.view.frame.size.height)];
     webView.delegate = self;
    [webViewController.view addSubview:webView];

     // setup and start the indicator
    _webViewLoadingIndicator = [[UIActivityIndicatorView alloc]initWithFrame:CGRectMake(roundf((self.view.frame.size.width - 50) / 2), roundf((self.view.frame.size.height - 50) / 2),50,50)];
    [webView addSubview:_webViewLoadingIndicator];
    [_webViewLoadingIndicator startAnimating];

     // send the request
     NSMutableURLRequest * request =[NSMutableURLRequest requestWithURL:[NSURL URLWithString:newsLink]];
    [webView loadRequest:request];

     // push the controller
    [self.navigationController pushViewController:webViewController animated:YES];

}

0 个答案:

没有答案