我有值存储在var中它会给出错误
Date*aDate=[appDelegate.dates objectAtIndex:indexPath.row];
NSInteger test=aDate.date;
cell.text=test;
这是Date类
@interface Date : NSObject {
NSInteger *date;
}
@property(nonatomic) NSInteger *date;
@end
#import "Date.h"
@implementation Date
@synthesize date;
-(id)init{
self=[super init];
}
- (id)initWithDictionary:(NSDictionary*) dict {
self.date = [dict valueForKey:@"date"];
return self;
}
@end
答案 0 :(得分:0)
这样做。
Date*aDate=[appDelegate.dates objectAtIndex:indexPath.row];
NSInteger test=aDate.date;
cell.textLabel.text= [NSString stringWithFormat:@"%d",test];
因为你不能将整数设置为单元格标签。