-4
private var distance: Double {
return fabs(max - min)
}
如何在Objective C語言中定義此變量。如何將此代碼從Swift轉換爲Objective C
private var distance: Double {
return fabs(max - min)
}
如何在Objective C語言中定義此變量。如何將此代碼從Swift轉換爲Objective C
在您.m文件:
@interface MyClass()
@property (nonatomic, assign, readonly) double distance;
@end
@implementation MyClass
-(double)distance {
return fabs(max - min);
}
@end
更好在Objc中使用'CGFloat' – markedwardmurray
什麼是晶圓廠,是它的功能? – triandicAnt
@ triple.s:http://pubs.opengroup.org/onlinepubs/009695399/functions/fabs.html。 –