목록2019/05/28 (1)
khstar
Swift 사용자의 시간제 설정 가져오기
사용자의 시간제 설정에 따라 날짜를 보여주고 싶었습니다. 그냥 DateFormat으로는 자동으로 안되서 사용자가 설정한 시간제를 가져오는 방법을 찾아봤습니다. 참고 사이트의 내용을 기록하기 위해 코드를 남깁니다. static func is24Hour() -> Bool { let locale = NSLocale.current let timeFormat = DateFormatter.dateFormat(fromTemplate: "j", options:0, locale:locale)! if timeFormat.contains("a") { //phone is set to 12 hours return false } else { //phone is set to 24 hours return true } } 참고 : h..
개발/Swift
2019. 5. 28. 23:06