Skip to content

Instantly share code, notes, and snippets.

@spraveenk91
Created October 31, 2014 11:23
Show Gist options
  • Save spraveenk91/bdf26607f363c8535042 to your computer and use it in GitHub Desktop.
Save spraveenk91/bdf26607f363c8535042 to your computer and use it in GitHub Desktop.
@protocol BaseDelegate <NSObject>
@required
- (void)didSelectActionSheetIndex:(NSString *)actionTitle actionSheetIndex:(NSInteger )index;
@end
@interface CustomAction : NSObject <UIActionSheetDelegate>
@property (nonatomic, assign) id<BaseDelegate> delegate; // Assign property
@end
--------------
@interface FirstViewController () <BaseDelegate, ActionDelegate>
@property (nonatomic, assign) NSInteger currentSelection;
@property (nonatomic, strong) CustomAction *actionObj;
@end
@implementation FirstViewController
@synthesize currentSelection, actionObj;
...
...
- (void)cellMenuClicked:(id)sender {
// CustomAction *obj = [[CustomAction alloc] init];
NSLog(@"Proto - %@", actionObj);
actionObj.delegate = self;
thumbActionSheet = [[UIActionSheet alloc] initWithTitle:nil delegate:actionObj cancelButtonTitle:@"Cancel" destructiveButtonTitle:nil otherButtonTitles:@"Add to Watchlist", @"Share", nil];
[thumbActionSheet showInView:[self.view window]];
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment