Develop
2014.05.12 21:58
[ios] 언어, 지역, 국가 설정 가져오기
조회 수 270439 댓글 0
아이폰에 설정된 지역 포맷(언어와 국가 정보)를 가져오려면 NSLocale 클래스를 사용한다.
지역 포맷 가져오기
NSLocale *currentLocale = [NSLocale currentLocale];
언어 설정 보기
NSLocale *currentLocale = [NSLocale currentLocale]; NSString *languageCode = [currentLocale objectForKey:NSLocaleLanguageCode]; // ko (en ...)
국가 설정 보기
NSLocale *currentLocale = [NSLocale currentLocale]; NSString *countryCode = [currentLocale objectForKey:NSLocaleCountryCode]; // KR (US ...)
언어와 국가 한번에 가져오기 (locale identifier)
NSLocale *currentLocale = [NSLocale currentLocale]; NSString *lcid = [currentLocale localeIdentifier]; // ko_KR (en_US ...)
아이폰에 설정된 언어(지역 포맷 아님)를 가져오려면 다음과 같이 할 수 있다.
NSString *preferredLanguageCode = [[NSLocale preferredLanguages] objectAtIndex:0]; // ko (en ...)
또는 NSUserDefaults 클래스를 사용할 수도 있다.
NSUserDefaults *userDefaults = [standardUserDefaults]; NSArray *languages = [userDefaults objectForKey: @"AppleLanguages"]; NSString *preferredLanguageCode = [languages objectAtIndex:0]; // ko (en ...)
번호 | 분류 | 제목 | 글쓴이 | 날짜 | 조회 수 |
---|---|---|---|---|---|
609 | Develop | [iOS] Xcode 불필요한 캐시 삭제하기 | hooni | 2021.10.12 | 1924 |
608 | Develop |
[ios] Xcode를 사용해서 Static Library 만들기 (시뮬레이터 + 디바이스)
![]() |
hooni | 2015.01.03 | 3380 |
607 | Develop | [ios] XCode에서 Provisioning Profile 여러개 중복될 때 | hooni | 2014.06.26 | 2889 |
606 | Develop |
[ios] Xcode에서 특정 파일만 ARC 따로 설정하는 방법
![]() |
hooni | 2017.03.29 | 1056 |
605 | Develop |
[ios] Xcode의 디버그 모드에서 콜스택
![]() |
hooni | 2015.01.03 | 1091 |
604 | Develop | [ios] 간단한 방법으로 OS버전 확인하기. | hooni | 2013.09.24 | 13346 |
603 | Develop | [ios] 개발 기초 가이드 링크.. | hooni | 2013.04.23 | 31411 |
602 | Develop | [ios] 구분자로 문자열 자르기 (split) | hooni | 2013.04.23 | 26310 |
601 | Develop |
[ios] 기본 네비게이션바의 타이틀, back버튼 위치와 속성 변경
![]() |
hooni | 2016.05.16 | 2172 |
600 | Develop |
[ios] 네트워크 인디케이터(NetworkActivityIndicator) 작동
![]() |
hooni | 2014.01.24 | 12510 |
599 | Develop |
[ios] 동영상 플레이어 샘플 (for Local File)
![]() |
hooni | 2017.02.07 | 1165 |
598 | Develop |
[ios] 동영상 플레이어 샘플 (for PIP Player)
![]() |
hooni | 2017.03.15 | 1380 |