0
我通過按表格視圖單元格加載頁面。我把一個if語句:webView加載不被稱爲
if ([webViewController webView].loading == YES) {
NSLog(@"Its loading!");
if (act == nil) {
NSLog(@"Its nil");
act = [[UIActivityIndicatorView alloc] initWithActivityIndicatorStyle:UIActivityIndicatorViewStyleWhiteLarge];
act.color = [UIColor blackColor];
} else {
act.hidden = NO;
}
act.center = self.view.center;
[act startAnimating];
} else {
[act stopAnimating];
[act setHidden: YES];
}
但NSLog的一直沒有出現,因此不會被調用。但是當我將它部署到我的iPhone時,需要很長的時間才能加載,但它仍然不會被調用。這裏發生了什麼?
更新 - SORROUNDING CODE
-(void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath {
NSLog(@"TOUCHED CELL!");
// Push the web view controller onto the navigation stack - this implicitly
// creates the web view controller's view the first time through
[[self navigationController] pushViewController:webViewController animated:YES];
// Grab the selected item
RSSItem *entry = [[channel items] objectAtIndex:[indexPath row]];
// Construct a URL with the link string of the item
NSURL *url = [NSURL URLWithString:[entry link]];
// Construct a request object with that URL
NSURLRequest *req = [NSURLRequest requestWithURL:url];
// Load the request into the web view
[[webViewController webView] loadRequest:req];
if ([webViewController webView].loading == YES) {
NSLog(@"Its loading!");
if (act == nil) {
NSLog(@"Its nil");
act = [[UIActivityIndicatorView alloc] initWithActivityIndicatorStyle:UIActivityIndicatorViewStyleWhiteLarge];
act.color = [UIColor blackColor];
act.center = self.view.center;
[self.view addSubview:act];
} else {
act.hidden = NO;
}
act.center = self.view.center;
[act startAnimating];
} else {
[act stopAnimating];
[act setHidden: YES];
}
webViewController = nil;
webViewController = [[WebViewController alloc] init];
}
上下文事項。這個代碼的功能是什麼?什麼代碼圍繞它? – NJones 2011-12-18 05:18:44
這是在uitableview委託協議方法: – user973985 2011-12-18 07:45:29
- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath { – user973985 2011-12-18 07:47:07