gpt4 book ai didi

iphone - 调用 setDatePickerMode 时出现 UIDatePicker 异常,区域格式设置为台湾日历为日语

转载 作者:搜寻专家 更新时间:2023-10-30 19:49:59 24 4
gpt4 key购买 nike

我们使用标准的 UIDatePicker View 来允许用户使用选择器设置倒计时持续时间。代码如下:

//in the header file
UIDatePicker *pickerView;

//in the implementation file, the error is thrown when this line executes
[self.pickerView setDatePickerMode:UIDatePickerModeCountDownTimer];

这在大多数情况下都可以正常工作,但是我们有一个用户将他们的区域格式设置为台湾,并将他们的日历设置为日语。然后发生以下异常:

2011-05-08 21:38:13.701 AppName[6418:207] * Assertion failure in -[UIDatePickerView _updateRowInColumn:toValue:withRepeatingAmount:element:animated:], /SourceCache/UIKit_Sim/UIKit-1447.6.4/UIDatePicker.m:1499 2011-05-08 21:38:13.703 AppName[6418:207] Terminating app due to uncaught exception 'NSInternalInconsistencyException', reason: 'whoa! too many rows for column: 1' ** Call stack at first throw: ( 0 CoreFoundation
0x00fa3be9 __exceptionPreprocess + 185 1 libobjc.A.dylib
0x010f85c2 objc_exception_throw + 47 2 CoreFoundation
0x00f5c628 +[NSException raise:format:arguments:] + 136 3
Foundation
0x000d447b -[NSAssertionHandler handleFailureInMethod:object:file:lineNumber:description:] + 116 4 UIKit 0x004b1e4e -[UIDatePickerView _updateRowInColumn:toValue:withRepeatingAmount:element:animated:] + 695 5 UIKit 0x004b5254 -[UIDatePickerView _loadDateAnimated:] + 1012

有没有人遇到过上述错误或如何解决这个问题?该组件的公历与非公历操作似乎存在问题。据我了解,如果未提供默认值,该组件将采用用户的设置:

来自 UIDatePicker.h:

@property(nonatomic,retain) NSLocale      *locale;                // default is nil. use current locale or locale from calendar
@property(nonatomic,retain) NSTimeZone *timeZone; // default is nil. use current time zone or time zone from calendar
@property(nonatomic,copy) NSCalendar *calendar; // default is [NSCalendar currentCalendar]. setting nil returns to default

最佳答案

您是否为您的实例变量 pickerView 创建了一个属性?由于您没有在问题中提到它,我想知道您如何访问 pickerView 的 setter 方法而不创建 @property(nonatomic, retain) UIDatePicker *pickerView;

关于iphone - 调用 setDatePickerMode 时出现 UIDatePicker 异常,区域格式设置为台湾日历为日语,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/5930270/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com