Here is the situation: I have a class MainView (which is a UIViewController) and call from it an UIActionSheetDelegate class. I want to use the method presentViewController, but the following code does not work (currently being called in the ActionSheet class):
[self presentViewController:myViewController animated:YES];
I am a little confused regarding where I should call the method from (MainView or the ActionSheetDelegate).
Thanks in advance.
You call the method on the UIViewController that is your MainView, and pass it your UIViewController you want to be the ActionSheet.
To dismiss the UIActionSheet,
dimissWithClickedButtonIndex:animated:
is a method for the UIActionSheet that you can implement. The method can be called by whoever (so if you want to dismiss it from your mainview have a reference to the action sheet and do something like[self.myActionSheet dismissWithClickedButtonIndex:0 animated:YES];
The method is also called whenever the 'cancel' button is clicked by the user.