Custom Selectable Action Sheet. YActionSheet provides you ability to see your selected option in ActionSheet view.
-
Drag YActionSheet directory to your xCode Project.
-
Make sure "Copy items if needed" is selected.
-
Import YActionSheet.h in file where you want to use it.
#import "YActionSheet.h"
- Initialize YActionSheet
YActionSheet *options = [[YActionSheet alloc] initWithTitle:@"Options"
dismissButtonTitle:@"Title"
otherButtonTitles:@[@"One", @"Two", @"Three", @"Four", @"Five"];
dismissOnSelect:NO];
- Open YActionSheet
[options showInViewController:self withYActionSheetBlock:^(NSInteger buttonIndex, BOOL isCancel) {
// Handle block completion
}];
Set pre selected option index. Call this before showing YActionSheet.
[options setSelectedIndex:selectedIndex];