【发布时间】:2011-03-30 05:06:54
【问题描述】:
我使用viewDidLoad 中的数组初始化表中的数据,然后将数据添加到单元格中。这是我在书中读到的标准方法。
这就是我所拥有的:
- (void)viewDidLoad {
[super viewDidLoad];
//Create array and add data ("tableViewValues" is initialized in .h file)
tableViewValues = [[NSMutableArray alloc]init];
[tableViewValues addObject:@"$280,000.00"];
[tableViewValues addObject:@"$279,318.79"];
}
// Customize the appearance of table view cells.
- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath {
static NSString *CellIdentifier = @"Cell";
UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:CellIdentifier];
if (cell == nil) {
cell = [[[UITableViewCell alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier:CellIdentifier] autorelease];
}
NSString *cellValue = [tableViewValues objectAtIndex:indexPath.row];
cell.textLabel.text = cellValue;
return cell;
}
所以当视图加载时,这两个货币值在我的表中。 现在在另一个函数中,我根据用户在文本字段中输入的内容,用不同的货币数字填充另一个数组。我将如何更新当前的表视图并将这些值替换为其他数组中的值?谁能帮我?谢谢!
【问题讨论】:
标签: ios objective-c uitableview