iOS UIActionSheet as a plugin

183 views Asked by At

I have a question about UIActionSheet. I'd like to create a little iOS plugin. Something like Appirater except instead of showing UIAlertView I'd like to show UIActionSheet with some customized options.

Nevertheless I don't know to what kind of app the plugin will be attached to? So basically under my ActionSheet could be anything. In UIAlertView you just call [myAlert show] and it works. Here you've got to call [myActionSheet showInView:myView].

1

There are 1 answers

2
rmaddy On BEST ANSWER

Plugin isn't the right term. You mean library or possibly framework. Anyway, assuming you are asking about the API you would provide in the main class of your library, you have a few options. You could provide a set of methods that essentially mirror the various 'show' methods of UIActionSheet and let the client of your library call the appropriate one. Or you could make it simpler and just make the client provide a view controller. Your library can then look at the view controller and show the action sheet appropriately. If the view controller is in a tabbed view, you show the action sheet that way. If the view controller has a toolbar, you show the action sheet for the toolbar. If all else fails, you show the action sheet from the view controller's view.

But either way, your API needs to get at least something from the client so it can properly show the action sheet.