【发布时间】:2017-05-10 23:40:43
【问题描述】:
这是我的代码,我正在尝试在 Array 中添加值并将它们填充到 Tableview 中。
-(NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section{
return [self.greekLetter count];
}
-(UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath{
NSString *SimpleIdentifier = @"SimpleIdentifier";
UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:SimpleIdentifier];
if(cell == nil){
cell = [[UITableViewCell alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier:SimpleIdentifier];
}
cell.textLabel.text = self.greekLetter[indexPath.row];
return cell;
}
当我添加值群代码值时,它在表格视图中显示正确。
self.greekLetter=@[@"prem",@"nath",@"kumar",@"shree"];
我想为数组动态添加值,它将显示在表格视图中。有人可以帮助我吗?
【问题讨论】:
-
添加值并在表格视图上调用
reloadData。
标签: ios objective-c tableview