VOActionSheetViewController
@interface VOActionSheetViewController : UIViewController
VOActionSheetViewController is a custom action sheet used by the SDK. It works similarly to a UIAlertController with style UIAlertControllerStyleActionSheet. Each action sheet item is an action in the controller. If there are too many actions to fit on screen, the actions will become scrollable. A cancel action is automatically added.
-
Action sheet items the
VOActionSheetViewController
uses. The view controller lays out action items based on this array.Declaration
Objective-C
@property (readonly, strong, nonatomic, nullable) NSArray<VOActionSheetItem *> *actionSheetItems;
Swift
var actionSheetItems: [VOActionSheetItem]? { get }
-
Delegate object for
VOActionSheetViewController
.Declaration
Objective-C
@property (readwrite, nonatomic, nullable) id<VOActionSheetViewControllerDelegate> delegate;
Swift
weak var delegate: VOActionSheetViewControllerDelegate? { get set }
-
Default initializer for
VOActionSheetViewController
.Declaration
Objective-C
+ (nonnull instancetype) vouchrActionSheetViewControllerWithTitle:(nonnull NSString *)title actionSheetItems: (nullable NSArray<VOActionSheetItem *> *) actionSheetItems vouchrTheme:(nullable VOTheme *)vouchrTheme;
Swift
class func vouchrActionSheetViewController(withTitle title: String, actionSheetItems: [VOActionSheetItem]?, vouchrTheme: VOTheme?) -> Self
Parameters
title
- The title that shows at the top of the Action sheet
actionSheetItems
- A list of all items shown in the action sheet
vouchrTheme
- the theme manager used to theme the Action sheet properly
Return Value
instance of VOActionSheetViewController
-
Presents the
VOActionSheetViewController
on a view controller with a custom slide / fade in animationDeclaration
Objective-C
- (void)showOnViewController:(nonnull UIViewController *)viewController onCompletion:(nullable void (^)(void))onCompletion;
Swift
func show(on viewController: UIViewController, onCompletion: (() -> Void)? = nil)
Parameters
viewController
- the view controller the action sheet should be added to
onCompletion
- completion block that is called when the animation is completed
-
Dismisses the
VOActionSheetViewController
with custom slide / fade out animation. This method is automatically called when a user selects an item or hits the cancel action. This only needs to be called if you want to cancel the action sheet seperately from the user picking an action.Declaration
Objective-C
- (void)dismissWithCompletion:(nullable void (^)(void))onCompletion;
Swift
func dismiss(completion onCompletion: (() -> Void)? = nil)
Parameters
onCompletion
- completion block that is called when the animation is completed