Why Can't I import a UITableViewCell subclass ? That's weird....
- by user320064
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