【发布时间】:2013-12-23 16:31:04
【问题描述】:
这快把我逼疯了。我有一个 webview 和一个 UIActivityIndicator。
由于某种原因,它不会加载到 webview 的中心,而是加载到左侧。
尝试了几个教程以使其正常工作,但无法弄清楚。
- (void)viewDidLoad
{
[super viewDidLoad];
// Do any additional setup after loading the view.
NSLog(@"PASSED URL IS %@", passedURL);
NSString *fullURL = passedURL;
//NSString *fullURL = @"http://107.22.183.71/index.php";
NSURL *url = [NSURL URLWithString:fullURL];
activityIndicator = [[UIActivityIndicatorView alloc]initWithActivityIndicatorStyle:UIActivityIndicatorViewStyleGray];
//Put the indicator on the center of the webview
[activityIndicator setCenter:self.view.center];
//Assign it to the property
self.activityIndicator=activityIndicator;
//Add the indicator to the webView to make it visible
[self.webView addSubview:self.activityIndicator];
NSURLRequest *requestObj = [NSURLRequest requestWithURL:url];
[_webView loadRequest:requestObj];
}
我怀疑这是我加载 webview 或指示器的顺序。
指标本身工作正常,我已经实现了所有需要的委托。
非常感谢任何帮助。
【问题讨论】:
标签: ios uiwebview uiactivityindicatorview