【发布时间】:2016-03-14 18:48:27
【问题描述】:
我有一个带有书签按钮的UIWebView。书签保存在UITableView 中。单元格的名称是书签的链接。现在我想单击单元格,然后书签的 url 应该在我的 webview 中响亮。但它不起作用,当我点击单元格时。
这是我的代码:
- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath {
static NSString *cellIdentifier = @"Cell";
UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:cellIdentifier];
if (cell == nil) {
cell = [[UITableViewCell alloc] initWithFrame:CGRectZero reuseIdentifier:cellIdentifier];
}
cell.textLabel.text = [bookmarks objectAtIndex:indexPath.row];
return cell;
}
-(void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath {
explorerView.urlField.text = [bookmarks objectAtIndex:indexPath.row];
[explorerView textFieldShouldReturn:explorerView.urlField];
[self.parentViewController dismissModalViewControllerAnimated:true];
}
你能给我一个代码示例如何做到这一点吗?这太棒了。
【问题讨论】:
标签: ios objective-c uitableview uiwebview bookmarks