【发布时间】:2017-03-09 07:30:59
【问题描述】:
if (_providerDatePicker) _providerDatePicker.hidden =
!_providerDatePicker.hidden; if (_providerToolbar)
_providerToolbar.hidden = !_providerToolbar.hidden; float screenWidth = [UIScreen mainScreen].bounds.size.width;
_providerToolbar = [[UIToolbar alloc] initWithFrame:CGRectMake(0, self.view.bounds.size.height - 244, self. view.bounds.size.width,
44)];
UIBarButtonItem *done = [[UIBarButtonItem alloc]
initWithBarButtonSystemItem:UIBarButtonSystemItemDone target:self
action:@selector(dismissActionSheet:)];
_providerToolbar.items = @[[[UIBarButtonItem alloc] initWithBarButtonSystemItem:UIBarButtonSystemItemFlexibleSpace
target:nil action:nil], done];
_providerToolbar.barStyle = UIBarStyleBlackOpaque; [self.view addSubview:_providerToolbar];
_providerDatePicker = [[UIDatePicker alloc] initWithFrame:CGRectMake(0, self.view.bounds.size.height - 200,
screenWidth, 200.0f)];
_providerDatePicker.backgroundColor = [UIColor whiteColor];
_providerDatePicker.datePickerMode = UIDatePickerModeDate; // [_providerDatePicker setLocale:[[NSLocale alloc]
initWithLocaleIdentifier:@"US"]];
_providerDatePicker.date = [NSDate date];
我正在使用按钮操作中的方法来显示 DatePicker,但它正在运行,但它显示如图所示。我想将其更改为 DD/MM/YY。帮帮我?
【问题讨论】:
-
@KiritModi 代码在 Swift 中...我需要目标 c
-
@RamanSrivastava 您已注释掉设置区域设置的调用,这不能解决您的问题吗?
-
美国格式通常是 m/d/y 几乎所有其他地方都使用 d/m/y en.wikipedia.org/wiki/Date_format_by_country
-
@GeorgeGreen 不,我的朋友它不工作
标签: ios objective-c