变量不是CFString如何删除它

时间:2011-07-28 06:50:36

标签: iphone objective-c

我有值存储在var中它会给出错误

Date*aDate=[appDelegate.dates objectAtIndex:indexPath.row];
NSInteger test=aDate.date;
cell.text=test;

这是Date类

Date.h

@interface Date : NSObject {
    NSInteger *date;

}
@property(nonatomic) NSInteger *date;

@end

Date.m

#import "Date.h"


@implementation Date
@synthesize date;

-(id)init{
    self=[super init];
}

- (id)initWithDictionary:(NSDictionary*) dict {
    self.date = [dict valueForKey:@"date"];

    return self;
}

@end

1 个答案:

答案 0 :(得分:0)

这样做。

Date*aDate=[appDelegate.dates objectAtIndex:indexPath.row];
NSInteger test=aDate.date;
cell.textLabel.text= [NSString stringWithFormat:@"%d",test];

因为你不能将整数设置为单元格标签。