UITableViewCells
UITableViewCells
- Subject: UITableViewCells
- From: William Squires <email@hidden>
- Date: Sun, 28 Jun 2009 17:00:05 -0500
Two questions here.
I have the following code in the tableView:cellForRowAtIndexPath:
method:
- (UITableViewCell *)tableView:(UITableView *)tableView
callForRowAtIndexPath:(NSIndexPath *)indexPath
{
static NSString *CellIdentifier = @"Cell";
UITableVIewCell *cell = [tableView
dequeueReusableCellWithIdentifier:CellIdentifier];
if (cell == nil)
{
cell = [[[UITableViewCell alloc]
initWithStyle:UITableViewCellStyleDefault
reuseIdentifier:CellIdentifier] autorelease];
}
// Configure the cell.
HighScoreSamplerAppDelegate *appDelegate =
(HighScoreSamplerAppDelegate *)[[UIApplication sharedApplication]
delegate];
NSDictionary *row = [[appDelegate highScores]
objectAtIndex:indexPath.row]; // Problem here
NSString *full_name = [row objectForKey:@"full-name"];
NSString *score = [row objectForKey:@"score"];
cell.text = [NSString stringWithFormat:@"%@ - %@", full_name, score];
// Warning on this line:
// "Warning: setText: is deprecated (declared at /Developer/
Platforms/iPhoneSimulator/... blah, blah
return cell;
}
Everything is fine up until the line
NSDictionary *row = [[appDelegate highScores]
objectAtIndex:indexPath.row];
"highScores" is defined in RootViewController.h as an NSMutableArray,
btw.
Question 1:
Looking in the debugger, I can see the argument "indexPath" is not
nil, but there's no "row" property shown by the debugger when I
expand it. Why didn't I get an exception for "indexPath does not
respond to selector 'row'"? And what is the name of the property I
need here?
Question 2:
I get a warning for "setText:" is deprecated for UITableViewCell.
What is the Apple-approved way of setting this now?
Using iPhone 3.0 SDK (I hope this post isn't still under NDA since
iPhone OS 3.0 is now out in the wilds...)
_______________________________________________
Cocoa-dev mailing list (email@hidden)
Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden