UIDatePicker
文字在弹出viewController
中作为子视图添加时被截断。
代码如下:
datePicker = [[UIDatePicker alloc] initWithFrame:CGRectMake(10, self.view.frame.size.height-120, self.view.frame.size.width-20, 120)];
datePicker.timeZone = [NSTimeZone localTimeZone];
datePicker.datePickerMode = UIDatePickerModeDateAndTime;
// self.datePicker.minimumDate = [NSDate date];
datePicker.backgroundColor=[UIColor grayColor];
[self.view addSubview:datePicker];
检查图片:
编辑:
Printing description of self->datePicker:
<UIDatePicker:0x7fd0b971c0a0; frame =(0 280; 300 120);layer =<CALayer: 0x7fd0bf30a2e0>>
(lldb) po self.view
<UIView: 0x7fd0bf331f40; frame = (0 0; 300 400); clipsToBounds = YES; autoresize = LM+RM+TM+BM; tag = 23942; layer = <CALayer: 0x7fd0bbf81730>>
答案 0 :(得分:0)
更改日期选择器框架宽度 您可以设置popupviewsize。而不是self.view width。
例如
而不是
datePicker = [[UIDatePicker alloc] initWithFrame:CGRectMake(0,self.view.frame.size.height-120,self.view.frame.size.width,120)];
应该是
datePicker = [[UIDatePicker alloc] initWithFrame:CGRectMake(0,self.view.frame.size.height-120,self.popupview.frame.size.width,120)];