1

我正在尝试使用 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");

}
4

2 回答 2

2

实现这个处理程序而不是clickedButtonAtIndex

- (void)actionSheet:(UIActionSheet *)actionSheet didDismissWithButtonIndex:(NSInteger)buttonIndex
于 2012-06-13T11:15:48.413 回答
1

请释放 UIActionSheet 即您创建的位置

[popupQuery release];
于 2012-06-13T11:12:55.570 回答