-(NSInteger)numberOfSectionsInTableView:(UITableView *)tableView

{

return 1;

}


-(NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection(NSInteger)section

{

return self.shopping_list.count;

}


-(UITableViewCell)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath

{

UITableViewCell cell = [tableView dequeueReusableCellWithIdentifier:@"tableCell"];

if (cell == nil)

cell = [[UITableViewCell alloc] initWithStyle:UITableViewCellStyleSubtitle reuseIdentifier:@"tableCell"];


cell.textLabel.text = self.shopping_list[indexPath.row][0];

cell.detailTextLabel.text = [NSString stringWithFormat:@"price = %4.0f, count= %d",

[self.shopping_list[indexPath.row][1] doubleValue],

[self.shopping_list[indexPath.row][2] IntegerValue]];


return cell;

}






참고자료




Posted by 하남각목
TAG , ,