我有一个UIActionSheet来提供表视图控制器上的用户选项。我以前在没有问题的情况下实现了这一点,但是由于某种原因,我的事件处理程序在单击按钮时不会触发。在我的头文件中,我按照以下方式实现了适当的委托:
@interface GaugeDetailTableViewController : UITableViewController <UIActionSheetDelegate>在我的实现中,我有以下代码来支持操作表:
-(void)loadPopup{
UIActionSheet *popup = [[UIActionSheet alloc]
initWithTitle:@"Options"
delegate:nil
cancelButtonTitle:@"Cancel"
destructiveButtonTitle:nil
otherButtonTitles:@"Add to Favorites", @"Gauge Detail Help", @"Main Menu", nil];
popup.actionSheetStyle = UIActionSheetStyleDefault;
[popup showInView:self.view];
}
-(void)actionSheet:(UIActionSheet *)actionSheet clickedButtonAtIndex:(NSInteger)buttonIndex{
NSLog(@"%d\n", buttonIndex);
}操作表正确地显示在视图控制器上,但由于某些原因,操作表单击事件处理程序将无法到达。有什么建议吗?谢谢!
发布于 2013-11-13 16:28:39
您需要设置委托:
UIActionSheet *popup = [[UIActionSheet alloc]
initWithTitle:@"Options"
delegate:self
cancelButtonTitle:@"Cancel"
destructiveButtonTitle:nil
otherButtonTitles:@"Add to Favorites", @"Gauge Detail Help", @"Main Menu", nil];
popup.actionSheetStyle = UIActionSheetStyleDefault;https://stackoverflow.com/questions/19959101
复制相似问题