我有以下代码:属性错误的目标C
在.H:
interface .... {
int CatID;
...
}
@property (readwrite) int CatID;
.m:
// Already includes the header file (.h)
implementation ... {
@synthesize CatID;
....
- (void)setCatIDa:(int)cid {
self.CatID = 20;
NSLog(@"cat id: %d", CatID); // this returns 20
}
- (IBAction)someTest:(id)sender {
NSLog(@"cat id: %d", CatID); // returns 0
}
}
如何找上门返回0?
而且笔尖意见设定之间变化,并得到
你最好发布你调用setter/getter的代码。 你为什么要做另一个二传手并用另一个名字叫它? – rano 2010-08-20 12:15:33
setCatIa只是为了解释问题和self.CatID设置int对吗? – Daniel 2010-08-20 12:30:45
你是指“//在另一个...”中的含义? – andyvn22 2010-08-20 13:14:34