Notice
Recent Posts
Recent Comments
Link
일 | 월 | 화 | 수 | 목 | 금 | 토 |
---|---|---|---|---|---|---|
1 | 2 | 3 | 4 | 5 | ||
6 | 7 | 8 | 9 | 10 | 11 | 12 |
13 | 14 | 15 | 16 | 17 | 18 | 19 |
20 | 21 | 22 | 23 | 24 | 25 | 26 |
27 | 28 | 29 | 30 |
Tags
- SWIFTUI
- Navigation
- 독후감
- xcode
- 스위프트
- viewcontroller
- Codegen
- NumberFormatter
- IOS
- 책후기
- @available
- 아이폰
- Structures and Classes
- SWIFT
- mvvm
- Mock
- Failed to register bundle identifier
- 독서후기
- UIResponder
- 야곰아카데미
- human interface guidelines
- roundingMode
- NotificationCenter
- contentInset
- Info.plist
- 스타트업주니어로살아남기
- View Life Cycle
- Modality
- delegation
- 부트캠프
Archives
- Today
- Total
목록roundingMode (1)
호댕의 iOS 개발

NumberFormatter를 보면 지정한 소수점에 맞춰 어떻게 올림, 버림, 반올림을 할 지 정할 수 있는 인스턴스 프로퍼티가 존재한다. 제목에도 나와있듯 roundingMode가 바로 그것이다. 여기서는 7가지 종류로 어떻게 소수점을 처리할 지 정할 수 있다. .up .down .ceiling .floor .halfUp .halfDown .halfEven 그렇다면 각각 어떤 식으로 소수점을 처리하는 것일까? .up Round away from zero. 0으로 부터 멀어지도록 소수점을 처리하게 된다. 즉 음수일 때는 작아지는 방향으로, 양수일 때는 커지는 방향으로 소수점을 처리한다. 만약 let numberFormatter = NumberFormatter() numberFormatter.maximum..
Software Engineering/Swift
2021. 11. 21. 21:33