Я создал UITableViewCell, и я пытаюсь отобразить его в одной из моих таблиц, но по какой-то причине он не приходит, стол становится пустым. И когда я нажимаю на ячейку в таблице, она выводит меня на следующий уровень, а это означает, что пользовательский UITableViewCell не получает визуализацию должным образом.Пользовательский UITableViewCell не отображается в таблице
Вот мой пользовательский UITableViewCell .h файл
@interface ProductViewCell : UITableViewCell {
IBOutlet UILabel *titleLabel;
IBOutlet UILabel *detailLabel;
IBOutlet UIImageView *imageView;
}
@property (nonatomic, retain) UILabel *titleLabel;
@property (nonatomic, retain) UILabel *detailLabel;
@property (nonatomic, retain) UIImageView *imageView;
Вот файл .m
#import "ProductViewCell.h"
@implementation ProductViewCell
@synthesize titleLabel, detailLabel, imageView;
- (void)setSelected:(BOOL)selected animated:(BOOL)animated {
[super setSelected:selected animated:animated];
}
@end
Здесь представлен .h файл, который подклассы UITableViewController
@interface ProductCategoryViewController : UITableViewController {
NSArray *tableDataSource;
}
@property (nonatomic, retain) NSArray *tableDataSource;
Вот .m файл для ProductCategoryViewController
@implementation ProductCategoryViewController
@synthesize tableDataSource;
- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:
(NSIndexPath *)indexPath {
static NSString *CellIdentifier = @"Cell";
ProductViewCell *cell = (ProductViewCell*)[tableView
dequeueReusableCellWithIdentifier:CellIdentifier];
if (cell == nil) {
cell = [[[ProductViewCell alloc] initWithStyle:UITableViewCellStyleDefault
reuseIdentifier:CellIdentifier] autorelease];
}
NSDictionary *dictionary = [self.tableDataSource objectAtIndex:indexPath.row];
cell.titleLabel.text = [dictionary objectForKey:@"name"];
cell.imageView.image = [UIImage imageNamed:[dictionary objectForKey:@"imageUrl"]];
return cell;
}
Ваша помощь приветствуется.
Спасибо, Yogesh
Что имя файла .xib ячейки? –
ProductViewCell.xib – Yogesh