我要对AppDelegate.m文件进行配置,使用24hours格式设置react-native-modal-datetime-picker。文档说要执行以下操作
The is24Hour prop is only available on Android but you use a small hack for enabling it on iOS by setting the app's default timezone as en_GB. To do so, edit your AppDelegate.m file, and add [[UIDatePicker appearance] setLocale:[[NSLocale alloc]initWithLocaleIdentifier:@"en_GB"]]; to application didFinishLaunchingWithOptions
但是我不知道我应该在AppDleate.m文件中的何处添加流动代码
我应该在哪里添加以上代码
答案 0 :(得分:0)
如引文中所述,您应该使用didFinishLaunchingWithOptions
方法添加它。
- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions
{
[[UIDatePicker appearance] setLocale:[[NSLocale alloc]initWithLocaleIdentifier:@"en_GB"]];
}
在AppDelegate.m
文件中添加以上代码。启动过程到此完成,您应该在此处进行此类配置。