【问题标题】:UIActionSheet and UIAlertView focus on iPadUIActionSheet 和 UIAlertView 专注于 iPad
【发布时间】:2011-03-10 09:07:26
【问题描述】:
我在 iPad 上使用 UIActionSheet 和 UIAlertView 时遇到了一些问题
事实上,我使用 alertView 作为带有文本字段和按钮的弹出窗口来输入
日期,当我单击包含我的 UIDatePicker 的 UIActionSheet 按钮应该显示时,它会显示但我没有焦点来选择日期
焦点仍然在 alertview 并且 ActionSheet 在后台
(但在 iphone 上没有问题,它工作正常)
有一些代码要为 iPad 添加吗?
感谢您的帮助
【问题讨论】:
标签:
cocoa-touch
ipad
uikit
uialertview
uiactionsheet
【解决方案1】:
在您的 AlertView 的 clickedButtonAtIndex 方法中显式关闭 alertView 并显示您的 ActionSheet。
使用;
- (void)dismissWithClickedButtonIndex:(NSInteger)buttonIndex animated:(BOOL)动画并呈现动作表
例如
- (void)alertView:(UIAlertView *)alertView clickedButtonAtIndex:(NSInteger)buttonIndex{
[alertView dismissWithClickedButtonIndex:0 animated:NO];
if(buttonindex==1{
[self showActionSheet]
}
}
注意,对于 Iphone,您可能不需要关闭 alertView。