현재 웹 서비스에서 데이터를 가져 와서 데이터를 사용자 정의 객체로 채우는 중입니다.NSDecimalNumber를 맞춤 클래스의 프라퍼티로 사용하는 올바른 방법
I가 기억하고 십진수 등 4.56
I로 약간 NSDecimal NSDecimalNumber과 혼동하고있다. 돈을 처리 할 때 NSDecimalNumber를 사용해야한다고 읽었습니다. 그래서 질문은 내 속성이 NSDecimal 또는 NSDecimalNumber 여야 여부입니다. 귀하의 모델이 NSDecimal이고 NSDecimalNumber를 숫자와 함께 사용하는 사례를 읽었습니다.
나는 기본적으로 내 thirtyYear 속성 NSDecimal 또는 NSDecimalNumber해야한다, 그래서
private decimal thirtyYear;
public decimal getThirtyYear(){
return thirtyYear/100.0;
}
public void setThrityYear(decimal rate){
thirtyYear = rate;
}
오브젝티브 -c
그러한 같은 동작을 만들려고합니다. 또한, getThirtyYear() 메서드 내에서 나누기를 수행 할 때 NSDecimalNumber를 산술에 사용해야합니다.