equal
deleted
inserted
replaced
78 UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:CellIdentifier]; |
78 UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:CellIdentifier]; |
79 if (cell == nil) { |
79 if (cell == nil) { |
80 cell = [[[UITableViewCell alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier:CellIdentifier] autorelease]; |
80 cell = [[[UITableViewCell alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier:CellIdentifier] autorelease]; |
81 } |
81 } |
82 |
82 |
83 if (0 == [indexPath section]) |
83 if (0 == [indexPath section]) { |
84 cell.textLabel.text = [hog objectForKey:@"hogname"]; |
84 cell.textLabel.text = [hog objectForKey:@"hogname"]; |
85 else |
85 cell.imageView.image = nil; |
|
86 cell.accessoryType = UITableViewCellAccessoryNone; |
|
87 } else { |
86 cell.textLabel.text = [[hatList objectAtIndex:[indexPath row]] stringByDeletingPathExtension]; |
88 cell.textLabel.text = [[hatList objectAtIndex:[indexPath row]] stringByDeletingPathExtension]; |
|
89 if ([cell.textLabel.text isEqualToString:[hog objectForKey:@"hat"]]) { |
|
90 cell.accessoryType = UITableViewCellAccessoryCheckmark; |
|
91 } else { |
|
92 cell.accessoryType = UITableViewCellAccessoryNone; |
|
93 } |
|
94 |
|
95 NSString *hatsPath = [[[NSBundle mainBundle] resourcePath] stringByAppendingString:@"/Data/Graphics/Hats/"]; |
|
96 NSString *hatFile = [hatsPath stringByAppendingString:[hatList objectAtIndex:[indexPath row]]]; |
|
97 UIImage *image = [UIImage imageWithContentsOfFile: hatFile]; |
|
98 |
|
99 CGRect firstSpriteArea = CGRectMake(0, 0, 32, 32); |
|
100 CGImageRef cgImgage = CGImageCreateWithImageInRect([image CGImage], firstSpriteArea); |
|
101 cell.imageView.image = [UIImage imageWithCGImage: cgImgage]; |
|
102 CGImageRelease(cgImgage); |
|
103 } |
87 |
104 |
88 return cell; |
105 return cell; |
89 } |
106 } |
90 |
107 |
91 |
108 |