Reputation: 1518
I am trying to use a UIAction sheet to confirm a user’s action. The log prints fine... but the app hangs and shows the lightened circle in the middle like when you do a UIAlert view. I’m sure its something simple... but can’t seem to find it.
-(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");
}
Upvotes: 1
Views: 487
Reputation: 2253
Please release the UIActionSheet i.e where you create
[popupQuery release];
Upvotes: 1
Reputation: 15400
Implement this handler instead of clickedButtonAtIndex
:
- (void)actionSheet:(UIActionSheet *)actionSheet didDismissWithButtonIndex:(NSInteger)buttonIndex
Upvotes: 2