NSInteger set to 0 but returns nil

后端 未结 3 1174
野的像风
野的像风 2020-12-17 18:51

I have an NSInteger in my class like so

In @interface:

NSInteger currentRow;    

@property (assign) NSInteger currentRow;

In @

3条回答
  •  再見小時候
    2020-12-17 18:59

    The getter method will be synthesized as - (NSInteger)currentRow so it should work just fine. But how do you check if it works? With NSLog(@"%@", ...)? Than you should use %d.

    If you want it to be an object you should use NSNumber and a retain property.

提交回复
热议问题