Last active
October 1, 2021 21:50
-
-
Save azu/5044045 to your computer and use it in GitHub Desktop.
和暦を利用時でもUIDatePickerでカレンダー:西暦の表示にする
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
UIDatePicker *datePicker = [[UIDatePicker alloc] init]; | |
// 言語は日本語(iOSの設定の書式に該当) | |
datePicker.locale = [[NSLocale alloc] initWithLocaleIdentifier:@"ja_JP"]; | |
// カレンダーは西暦(iOSの設定のカレンダーに該当) | |
NSCalendar *gregorian = [[NSCalendar alloc]initWithCalendarIdentifier:NSGregorianCalendar]; | |
gregorian.locale = [NSLocale currentLocale]; | |
datePicker.calendar = gregorian; | |
datePicker.datePickerMode = UIDatePickerModeDateAndTime; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment