Why Can't I import a UITableViewCell subclass ? That's weird....
Posted
by user320064
on Stack Overflow
See other posts from Stack Overflow
or by user320064
Published on 2010-04-19T06:50:52Z
Indexed on
2010/04/19
6:53 UTC
Read the original article
Hit count: 220
It's like this, I created a UITableViewCell subclass called NewsItemCell, then I wanna use it in my FirstViewController.m, then I tried to import it, but the compiler keeps telling me this
Below is my code, it is driving me mad, thank you if you can help.
import "NewsItemCell.h"
import "FirstViewController.h"
@implementation FirstViewController @synthesize computers;
(UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath { static NSString *CellIdentifier = @"NewsItemCellIdentifier";
NewsItemcell *cell = (NewsItemcell *)[tableView dequeueReusableCellWithIdentifier: CellIdentifier]; if (cell == nil)
{ NSArray *nib = [[NSBundle mainBundle] loadNibNamed:@"NewsItemCell" owner:self options:nil]; for (id oneObject in nib) if ([oneObject isKindOfClass:[NewsItemcell class]]) cell = (NewsItemcell *)oneObject; } NSUInteger row = [indexPath row]; NSDictionary *rowData = [self.computers objectAtIndex:row]; cell.newsTitle.text = [rowData objectForKey:@"Color"]; cell.newsDate.text = [rowData objectForKey:@"Name"]; return cell; }
Jason
© Stack Overflow or respective owner