Praveenkumar
Praveenkumar

Reputation: 24476

Handling UIActionSheet

In my application i should have a common UINavigationBar to hold with 3 UIBarButton items with its actions. So, instead of writting code in every ViewControllers, i have decided to create on BaseViewController which can be subclass to my application ViewControllers,

After, implementing this UINavigationBar showing with its items fine. In one of my bar button item in BaseVC will present UIActionSheet and when select something from this, need to get selected index from BaseVC to MainVC. So, i have created a custom protocol method to pass the selected action sheet index to my MainVC from BaseVC.

MainVC == FirstViewController

This scenario also getting works. But, if i add one or more UIActionSheet in my FirstVC its getting called and works fine. But, it disables the BaseVC's Actionsheet delegate call. It means, it is not allowing to call the delegate on BaseVC,

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

Above delegate not fired in BaseVC. How to handle both UIActionSheet from different VC.

Any idea regarding this?

Upvotes: -1

Views: 111

Answers (1)

borrrden
borrrden

Reputation: 33421

In this case you have to invoke it manually using logic in your FirstViewController method call. You can do this by calling [super actionSheet:actionSheet clickedButtonAtIndex:buttonIndex] when you know the call is meant to be handled by the BaseVC.

Upvotes: 0

Related Questions