在iPhone上使用Xcode 5
我尝试在MVC中的tableview
(非本地数组)中显示array
中的数据 - 但数据未显示在表中并显示为空网格。
我使用storyboard
(不是笔尖)和custom cell
(不是TableViewController)。
你能告诉我我错过了什么吗?提前致谢
代码如下所示:
-(NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection: (NSInteger)section {
NSLog (@"array count is %i", listRecipes.recipeArray.count);
return [listRecipes.recipeArray count];
}
以及
-(UITableViewCell )tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath {
static NSString cellIdentifier = @"ListCellIdentifier";
MYCustomListCell* listCell = [tableView dequeueReusableCellWithIdentifier:cellIdentifier];
NSString* dataString = listRecipes.recipeArray[indexPath.row];
listCell.listName.text = dataString;
listCell.imageView.image = [UIImage imageNamed:dataString];
return listCell;
}
答案 0 :(得分:0)
您应该为此问题添加一些代码。
我的猜测是你还没有为UITableViewDataSource的tableView提供一个实现:numberOfRowsInSection:
这应该可能会返回数组中对象的数量。