这里是obj-C和Cocoa的新手
我试图在一个方法中增加一个变量,并且习惯于C++,我想只使用变量++的术语,但这不适用于NSNumber,所以我想出了
player1Points = [NSNumber numberWithInt:([player1Points intValue] + 1)];
我很想重新将player1Points重新声明为标题中的int,但我想保留@synthesize和@property,以便我不必编写get和set例程.
有没有更简单的方法来编写这行代码?
math cocoa objective-c increment nsnumber
cocoa ×1
increment ×1
math ×1
nsnumber ×1
objective-c ×1