我有一个带有新闻的主从应用程序。有用。我使用的详细控制器UIWebView
。我用xib创建了评论类,并试图将它添加到我的详细视图中。评论是。之后我只能看到评论,而不是详细信息。UITableViewController
我试图滚动我的webview并且没有文本。但是在detailviewController中,我NSLog
为我的文本做了并看到了它。如果我设置newsTextHeight
为480 ,我会看到一个空视图。
我究竟做错了什么?
- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath
{
CGFloat newsTextHeight = 250;
DetailViewController *detailViewController = [[DetailViewController alloc] initWithNibName:@"DetailViewController" bundle:nil];
CommentsViewController *commentController = [[CommentsViewController alloc] init];
NewsItem *newsItem = [news objectAtIndex:indexPath.row];
detailViewController.description = newsItem.description;
detailViewController.title = newsItem.date;
commentController.news_id = newsItem.news_id;
detailViewController.news_id = [newsItem.news_id intValue];
int views = [newsItem.viewsCnt intValue];
views++;
NSString *strFromInt = [NSString stringWithFormat:@"%d",views];
newsItem.viewsCnt = strFromInt;
[self.tableView reloadData];
//[self.navigationController presentedViewController];
[self.navigationController pushViewController:detailViewController animated:YES];
detailViewController.navigationController.toolbarHidden = NO;
[detailViewController addChildViewController:commentController];
[commentController didMoveToParentViewController:detailViewController];
[detailViewController.view addSubview:commentController.view];
detailViewController.view.frame = CGRectMake(0, 0, detailViewController.view.bounds.size.width, newsTextHeight);
commentController.tableView.contentInset = UIEdgeInsetsMake(detailViewController.view.frame.size.height, 0, 0, 0);
[commentController release];
[detailViewController release];
}