【发布时间】:2012-07-16 22:47:17
【问题描述】:
我有以下自定义对象:
@interface LoadDescription : NSObject
@property (nonatomic) float start, stop, startMagnitude, stopMagnitude;
@end
我的一个控制器中有一个对象作为属性:
@property (nonatomic, strong) LoadDescription *editingLoad;
但是当我尝试在editingLoad属性中设置/获取属性时......
float tableValue = [textField.text floatValue];
NSLog(@"value in table is %f", tableValue);
self.editingLoad.startMagnitude = tableValue;
NSLog(@"Load magnitude is %i", (int)self.editingLoad.startMagnitude);
...并运行 iOS,控制台输出显示虽然 tableValue 是我输入的任何值,但 self.editingLoad.startMagnitude 始终为 0.00000000,这让我认为 setter/getter 有问题。
如果相关,我正在运行 ARC。
任何帮助表示赞赏,在此先感谢!
【问题讨论】:
-
你检查 self.editingLoad 不是 nil 吗?
标签: iphone objective-c ios ipad properties