在 iPhone 上,此代码显示取消按钮:
- (IBAction)buttonPressed
{
UIActionSheet *actionSheet = [[UIActionSheet alloc]
initWithTitle:@"Are you sure?"
delegate:self
cancelButtonTitle:@"No way!"
destructiveButtonTitle:@"Yes, I'm sure!"
otherButtonTitles:nil];
[actionSheet showInView:self.view];
[actionSheet release];
}
但在 iPad 上,只显示破坏性按钮。
有什么问题吗?
最佳答案
这是 UI design and guidlines 的一部分。在“行动表”下,他们说:
Do not include a Cancel button, because people can tap outside the popover to dismiss the action sheet without selecting one of the other alternatives.
看起来像 SDK hide the button for you on purpose 。我不确定是否有解决方案,但也许您可以添加自己的按钮并设置 cancelButtonIndex
进行匹配。或者您可以切换到 UIAlertView
。
关于iphone - iPad 上的操作表不显示“取消”按钮,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/2760545/