Develop
2014.05.12 21:58
[ios] 언어, 지역, 국가 설정 가져오기
조회 수 270820 댓글 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 ...)
번호 | 분류 | 제목 | 글쓴이 | 날짜 | 조회 수 |
---|---|---|---|---|---|
661 | Develop |
[c] 콘솔에서 패스워드 입력시 문자 보이지 않게 하는 코드
![]() |
hooni | 2013.04.23 | 8359 |
660 | Develop |
[c++] MD5 구현 소스.. 퍼움..
![]() |
hooni | 2013.04.23 | 24136 |
659 | Develop |
[c] 무선 Radius Server 자료..
![]() |
hooni | 2013.04.23 | 7279 |
658 | Develop |
[c++] WinSock2.0 채팅 프로그램 ㅋㅋ
![]() |
hooni | 2013.04.23 | 8563 |
657 | Develop | [c++] 소켓 프로그래밍 관련 링크.. (퍼올려고 올린거) | hooni | 2013.04.23 | 7060 |
656 | Develop |
[c] 퀵정렬(quick sort) 예제 소스..
![]() |
hooni | 2013.04.23 | 7992 |
655 | Develop |
[c] 확인해 볼거.. ㅡ,.ㅡ;
![]() |
hooni | 2013.04.23 | 7174 |
654 | Develop |
[c] 자료구조 그래프(graph) 소스코드 - 확인해볼 것..
![]() |
hooni | 2013.04.23 | 8009 |
653 | Develop |
[linux] 임베디드 리눅스 (embedded linux)
![]() |
hooni | 2013.04.23 | 7381 |
652 | Develop |
[c] 메세지 프로그램 (Server - Agent - Client)
![]() |
hooni | 2013.04.23 | 6478 |
651 | Develop |
[java] 채팅 프로그램.. swing 사용..
![]() |
hooni | 2013.04.23 | 8366 |
650 | Develop |
[java] 에디터.. swing 사용
![]() |
hooni | 2013.04.23 | 6327 |