我正在尝试编写一个 SplitView 控制程序,其中按下 masterViewController 中的表格单元格会导致关联的网页加载到详细视图控制器中。我在详细视图控制器中有以下方法,我可以确认它正在被调用并且正在接收正确的输入:
-(void)masterAction:(id)sender {
NSString *http = @"http://";
http = [http stringByAppendingString:sender];
_urlString = http;
NSURL *url= [NSURL URLWithString:_urlString];
[self.web loadRequest:[NSURLRequest requestWithURL:url]];
}
但是,没有加载任何内容。任何想法为什么会这样?我能够加载任何内容的唯一方法是在我的 viewDidLoad 方法中插入类似于以下内容的内容:
NSURL *url= [NSURL URLWithString:@"http://www.google.com];
[self.web loadRequest:[NSURLRequest requestWithURL:url]];
正在使用以下方法调用该方法:
-(void)tableView:(UITableView *)tableView didDeselectRowAtIndexPath:(NSIndexPath *)indexPath
{
NSDictionary *thread = [self.issueData objectForKey:@"responseData"];
NSDictionary *feed = [thread objectForKey:@"feed"];
NSArray *entries = [feed objectForKey:@"entries"];
NSDictionary *posts = entries[indexPath.row];
NSString *urlString = [posts objectForKey:@"link"];
NSArray *split = [urlString componentsSeparatedByString:@"url=http://"];
NSString *url = [split objectAtIndex:1];
[self.delegate masterAction:url];
}