IPhone SDK: UIActionsheet delegate method that is not called

In my iPhone application, I have an action table that has 4 buttons.

Now, to perform actions when I click these buttons, I implemented an ActionSheet delegate.

The delegate method of the action sheet is not called when the buttons are clicked. The same code works if it is integrated into another project.

I correctly named all the method names.

Below is a screenshot showing the delegate method

alt text

What could be wrong?

Please help and suggest

Thanks.

+4
source share
2 answers

Make sure your UIActionSheet delegate is configured on its own:

actionSheet.delegate = self; 

and make sure you use <UIActionSheetDelegate> in the header file.

+7
source

If you use the code to invoke the action sheet as shown below

 UIActionSheet *actionSheet = [[UIActionSheet alloc] initWithTitle:@"YOUR TITLE" delegate:self cancelButtonTitle:nil destructiveButtonTitle:@"YOUR MESSAGE" otherButtonTitles:@"Cancel", nil]; [actionSheet showInView:self.view]; [actionSheet release]; 

Then there will be no problem calling the delegate method,

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

Greetings

+4
source

Source: https://habr.com/ru/post/1334206/


All Articles