public
Created

  • Download Gist
RDViewController.h
Objective-C
1 2 3 4 5 6 7 8 9 10
#import <UIKit/UIKit.h>
#import "RDActionSheet.h"
 
@interface RDViewController : UIViewController <RDActionSheetDelegate>
 
@property (nonatomic, strong) IBOutlet UIButton *showActionSheetButton;
 
- (IBAction)showActionSheet:(id)sender;
 
@end
RDViewController.m
Objective-C
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47
@implementation RDViewController
 
@synthesize showActionSheetButton;
 
#pragma mark - View management
 
- (void)viewDidLoad {
[super viewDidLoad];
// Do any additional setup after loading the view, typically from a nib.
}
 
- (void)viewDidUnload {
[super viewDidUnload];
// Release any retained subviews of the main view.
}
 
#pragma mark - Show action sheet action
 
- (IBAction)showActionSheet:(id)sender {
RDActionSheet *actionSheet = [[RDActionSheet alloc] initWithCancelButtonTitle:@"Cancel" primaryButtonTitle:@"Save" destroyButtonTitle:@"Destroy" otherButtonTitles:@"Email", @"Tweet", nil];
actionSheet.delegate = self;
[actionSheet showFrom:self.view];
}
 
#pragma mark - RDActionSheetDelegate
 
- (void)actionSheet:(RDActionSheet *)actionSheet clickedButtonAtIndex:(NSInteger)buttonIndex {
NSLog(@"Pressed %i", buttonIndex);
}
 
- (void)actionSheetDidBecomeCancelled:(RDActionSheet *)actionSheet {
NSLog(@"ActionSheet cancelled");
}
 
#pragma mark -
 
- (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation {
return (interfaceOrientation != UIInterfaceOrientationPortraitUpsideDown);
}
 
@end

Please sign in to comment on this gist.

Something went wrong with that request. Please try again.