0
我的自定义tableview单元格有问题。当我想将文字放在我的标签上时,它不会改变。这是我的代码的样子。自定义UITableviewCell不会设置标签
我NieuwsTableViewCell.h
@interface NieuwsTableViewCell : UITableViewCell{
}
@property (nonatomic, retain) IBOutlet UILabel *topic;
@property (nonatomic, retain) IBOutlet UILabel *omschrijving;
@end
我NieuwsTAbleViewCell.m
@implementation NieuwsTableViewCell
@synthesize topic;
@synthesize omschrijving;
和我firstViewController.m
- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath
{
static NSString *CellIdentifier = @"Cell";
NieuwsTableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:CellIdentifier];
if (cell == nil) {
NSArray* views = [[NSBundle mainBundle] loadNibNamed:@"NieuwsTableViewCell" owner:nil options:nil];
for (UIView *view in views) {
if([view isKindOfClass:[UITableViewCell class]])
{
NSDictionary *info = [json objectAtIndex:indexPath.row];
cell.topic.text = @"Stef";
cell.omschrijving.text = [info objectForKey:@"Nie_omschrijving"];
NSLog(@"voorlopige test");
cell = (NieuwsTableViewCell*)view;
}
}
}
return cell;
}
它工作!谢谢 ! – steaphann