单击UIActionSheet按钮后应用程序挂起

时间:2012-06-13 11:00:21

标签: ios uialertview uiactionsheet

我正在尝试使用UIAction表来确认用户的操作。日志打印很好......但应用程序挂起并显示中间的亮环,就像您执行UIAlert视图一样。我确信它很简单......但似乎无法找到它。

-(IBAction)showActionSheet:(id)sender
{
UIActionSheet *popupQuery = [[UIActionSheet alloc] initWithTitle:@"Are you sure?" delegate:self cancelButtonTitle:@"Cancel Button" destructiveButtonTitle:@"Reset Player" otherButtonTitles:nil];
popupQuery.actionSheetStyle = UIActionSheetStyleBlackOpaque;

[popupQuery showInView:self.view];



}


-(void)actionSheet:(UIActionSheet *)actionSheet clickedButtonAtIndex:(NSInteger)buttonIndex {
if (buttonIndex == 0) {
    NSLog(@"Destructive Button Clicked");
}
else if (buttonIndex == 1) {
    NSLog(@"Cancel Clicked");

}

2 个答案:

答案 0 :(得分:2)

实现此处理程序而不是clickedButtonAtIndex

- (void)actionSheet:(UIActionSheet *)actionSheet didDismissWithButtonIndex:(NSInteger)buttonIndex

答案 1 :(得分:1)

请发布UIActionSheet,即您创建的地方

[popupQuery release];