【发布时间】:2012-01-13 21:10:56
【问题描述】:
我的主视图中的弹出框内有一个表格视图,它是一个网络浏览器。每当用户访问一个网页时,我希望它将该页面添加到最近访问过的网站列表中。我设置了代码以将 URL 作为字符串添加到作为表格视图的数据源的数组中。表格视图仅显示访问的第一个站点,并且不会显示任何内容。但是我知道这些站点正在添加到数组中,因为该数组在添加后使用 NSLog 语句显示站点。但是它们仍然不会出现在表格中。谁能帮帮我?
编辑:
- (NSInteger)numberOfSectionsInTableView:(UITableView *)tableView
{
// Return the number of sections.
return 1;
}
- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section
{
// Return the number of rows in the section.
return [recentlyVisitedUrls count];
}
【问题讨论】:
-
你在打电话给
[tableView reloadData]吗? -
是的,但它会删除以前存在的数据
标签: objective-c ios uitableview nsarray