iphone - 为什么带有 UIDatePicker 的自定义 UIActionSheet 的下半部分被禁用?

标签 iphone cocoa-touch datepicker uidatepicker uiactionsheet

对于包含 UIDatePicker 的 UIActionSheet,一切似乎都运行良好,只是 DatePicker 的下半部分被禁用。从视觉上看,有一个阴影使选择器的下半部分比上半部分更暗。下半部分的所有内容都被禁用,我一生都无法弄清楚如何启用它。

我还注意到在其他仅包含按钮的“正常”UIActionSheets 中,取消按钮的下半部分被禁用。

这是我的自定义 UIActionSheet 的代码:

self.datePickerView = [[UIDatePicker alloc] init];
self.datePickerView.datePickerMode = UIDatePickerModeDate;

self.actionSheet = [[UIActionSheet alloc] initWithTitle:@"Choose a Follow-up Date"
                   delegate:self cancelButtonTitle:nil 
                   destructiveButtonTitle:nil otherButtonTitles:@"Done", nil];

[self.actionSheet showInView:self.view];
[self.actionSheet addSubview:self.datePickerView];
[self.actionSheet sendSubviewToBack:self.datePickerView];
[self.actionSheet setBounds:CGRectMake(0,0,320, 500)];

CGRect pickerRect = self.datePickerView.bounds;
pickerRect.origin.y = -95;
self.datePickerView.bounds = pickerRect;

我尝试过几种方法,包括 sendSubviewToBack、BringSubviewToFront 等,但我没有任何运气。感谢您的帮助!

这是一个屏幕截图。我添加了红色框以进行澄清。 alt text http://gorgando.com/UIActionSheet%20Problem.png

最佳答案

尝试在 UIDatePicker 上设置框架而不是边界。我认为当您将原点设置为 -95 来定位它时,会发生一些奇怪的事情。

关于iphone - 为什么带有 UIDatePicker 的自定义 UIActionSheet 的下半部分被禁用?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/3048991/

相关文章:

javascript - jQuery UI DatePicker - 只显示全年的 3 天

iphone - 逐帧播放视频

ios - App Store 审核指南 : 12. 1 - 集成 Itunes 播客

javascript - 使用 jquery 触发另一个日期时间选择器

iphone - 在 UIScrollView 上添加多个 MPMoviePlayerController?

ios - 如何使用 XIB 自定义 tableView Section Header?

javascript - 如何禁用 `datepickr.js` 中的过去日期?

iphone - 如何在 iOS 上获取模板选择器/文档浏览器 View ?

iphone - 在 iphone 中扫描这么多次后,条形码阅读器 View 出现两次?

ios - iPhone : Get the file path which is within subfolder of Resource folder