Objective-C. Property for C array

后端 未结 4 1096
不思量自难忘°
不思量自难忘° 2020-12-18 09:01

I need something like this:

@property (nonatomic, retain) int field[10][10];

but this code doesn\'t work. How to replace it? I need both se

4条回答
  •  再見小時候
    2020-12-18 09:07

    Write setter and getter

    - (int) field:(int)i j:(int)j {
        return field[i][j];
    }
    
    - (void)setField:(int)i j:(int)j toValue:(int)value {
        field[i][j] = value;
    }
    

提交回复
热议问题