UIActionSheet 委托方法不会被调用
我有一个操作表,似乎只在单击“是”按钮时调用 clickedButtonAtIndex 委托方法,而不是在“否”按钮上...这是代码:
self.myActionSheet = [[UIActionSheet alloc] initWithTitle:@"Test" delegate:self
cancelButtonTitle:@"No" destructiveButtonTitle:@"Yes" otherButtonTitles:nil];
[self.myActionSheet showInView:self.view];
[myActionSheet release];
然后是委托方法:
- (void)actionSheet:(UIActionSheet *)myActionSheet
clickedButtonAtIndex:(NSInteger)buttonIndex {
if (buttonIndex == 1) {
[self.myActionSheet dismissWithClickedButtonIndex:1 animated:YES];
return;
}
我的断点位于第一行除非我触摸,否则程序不会受到影响 “是”按钮。我已将其更改为cancelButtonTitle:nil,然后将“否”放在另一个按钮上(otherButtonTitles:@“否”,nil)。同样的事情。
有什么帮助吗?
谢谢!
I have an actionsheet that seems to only call the clickedButtonAtIndex delegate method when I click the "Yes" button, but not on the "No" button... Here's the code:
self.myActionSheet = [[UIActionSheet alloc] initWithTitle:@"Test" delegate:self
cancelButtonTitle:@"No" destructiveButtonTitle:@"Yes" otherButtonTitles:nil];
[self.myActionSheet showInView:self.view];
[myActionSheet release];
then the delegate method:
- (void)actionSheet:(UIActionSheet *)myActionSheet
clickedButtonAtIndex:(NSInteger)buttonIndex {
if (buttonIndex == 1) {
[self.myActionSheet dismissWithClickedButtonIndex:1 animated:YES];
return;
}
My breakpoint at the first line of this procedure doesn't get hit unless I touch the
"Yes" button. I have changed this to have the cancelButtonTitle:nil and then put the "No" on another button (otherButtonTitles:@"No", nil). Same thing.
Any help?
Thanks!
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
尝试触摸“否”按钮的最顶部。有效吗?
你有标签栏或工具栏吗?如果是这样,请尝试从选项卡栏或工具栏显示操作表。 “否”按钮可能会被栏部分遮挡。
Try touching the very top of the No button. Does it work?
Do you have a tab bar or a tool bar? If so, try showing the action sheet from the tab bar or the tool bar. The No button could be partially obscured by the bar.
不,这不是一个错误......只是一个“房地产”问题。
从 UIActionSheet 标头看一下 API...
No, its not a bug.. just a "Real Estate" issue.
take a look at the API.. from the UIActionSheet header...