Reputation: 1757
when i use this code it shows an error
- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath {
static NSString *CellIdentifier = @"Cell";
UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:CellIdentifier];
if (cell == nil) {
cell = [[UITableViewCell alloc] initWithFrame:CGRectZero reuseIdentifier:CellIdentifier] ;
}
// Set up the cell
SQLiteTutorialAppDelegate *appDelegate = (SQLiteTutorialAppDelegate *)[[UIApplication sharedApplication] delegate];
Animal *animal = (Animal *)[appDelegate.animals objectAtIndex:indexPath.row];
[cell setText:animal.name];
return cell;
}
when i use [cell setText:animal.name] it shows an error like 'setText' is deprecated.
Upvotes: 0
Views: 846
Reputation: 8323
That's because the UITableViewCell
text
property was deprecated as of iOS 3.0--see the reference here. The UILabel
that is used for the text label is exposed as the textLabel
property of a UITableView
instance. Try this instead:
cell.textLabel.text = animal.name;
Upvotes: 1
Reputation: 5183
Yeah..use the following line instead..
[cell.textLabel setText:(NSString *)]
Upvotes: 1