UICustomActionSheet not calling delegate method to handle events

28 Views Asked by At

i am using this example in my code. And it is working just fine for now but when i tap on a button it did not respond or call any method. here is my code:

UICustomActionSheet* customActionSheet = [[UICustomActionSheet alloc] initWithTitle:nil delegate:nil buttonTitles:@[@"Cancel",@"Delete picture", @"Take a new photo", @"Choose from existing"]];
    [customActionSheet setButtonColors:@[[UIColor redColor]]];
    [customActionSheet setBackgroundColor:[UIColor clearColor]];
    [customActionSheet setSubtitle:@"Select your Choice"];
    [customActionSheet setSubtitleColor:[UIColor whiteColor]];
    [customActionSheet showInView:self.view];

and here is method that needs to be called

-(void)customActionSheet:(UICustomActionSheet *)customActionSheet clickedButtonAtIndex:(NSInteger)buttonIndex{
    NSLog(@"%d",buttonIndex);
}
1

There are 1 best solutions below

2
Vishal Sonawane On BEST ANSWER

The problem is with your delegate. You have set it nil. Set it to self and your problem will be solved.