【问题标题】:Dismiss UIActionSheet by tapping darkened area on iPhone通过点击 iPhone 上的深色区域来关闭 UIActionSheet
【发布时间】:2010-12-16 17:42:59
【问题描述】:

我在 UIActionSheet 中有一个 UIPickerView。是否可以只点击变暗区域并将 UIActionSheet 与 UIPickerView 一起关闭?如果不是,如何添加取消按钮?

我需要以编程方式完成所有这些操作。

【问题讨论】:

  • UIActionView 视图并不意味着包含 UIPickerView 子视图。为什么不直接从底部滑入UIPickerView,自己画出变暗的区域呢?

标签: iphone objective-c xcode ios


【解决方案1】:

我不认为在 UIActionSheet 中添加 UIPickerView 是一个很棒的决定,但我想视图上的触摸事件可以解决问题:

- (void)touchesEnded:(NSSet *)touches withEvent:(UIEvent *)event {
    //Code to dismiss stuff here, like:
    //[myPickerView setHidden:YES];
}

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多