2 つのテーブルビューがあり、各テーブルビューには含まれるセルが 1 つしかないため、この 2 つのテーブルビューのセルに 1 つの UIWebView を追加したい
- (void)loadView
{
interestView = [[UIWebView alloc] initWithFrame:_webViewFrame];
interestView.delegate = self;
}
- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath
{
UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:@"Cell"];
if (cell == nil) {
cell = [[UITableViewCell alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier:@"Cell"];
}
//interestView is UIWebView
if (tableView == interestTableView) {
[cell.contentView addSubview:interestView];
}else if (tableView == headerTableView) {
[cell.contentView addSubview:interestView];
}
}
しかし、これは機能しません。両方の表のセルにUIWebViewが表示されません。何か案が?