This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// | |
// RDViewController.h | |
// RDActionSheet | |
// | |
// Created by Red Davis on 16/03/2012. | |
// Copyright (c) 2012 Red Davis. All rights reserved. | |
// | |
#import <UIKit/UIKit.h> | |
#import "RDActionSheet.h" | |
@interface RDViewController : UIViewController | |
@property (nonatomic, strong) IBOutlet UIButton *showActionSheetButton; | |
- (IBAction)showActionSheet:(id)sender; | |
@end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// | |
// RDViewController.m | |
// RDActionSheet | |
// | |
// Created by Red Davis on 16/03/2012. | |
// Copyright (c) 2012 Red Davis. All rights reserved. | |
// | |
#import "RDViewController.h" | |
@interface RDViewController () | |
@end | |
@implementation RDViewController | |
@synthesize showActionSheetButton; | |
#pragma mark - View management | |
- (void)viewDidLoad { | |
[super viewDidLoad]; | |
} | |
- (void)viewDidUnload { | |
[super viewDidUnload]; | |
} | |
#pragma mark - Action sheet | |
- (IBAction)showActionSheet:(id)sender { | |
RDActionSheet *actionSheet = [[RDActionSheet alloc] initWithCancelButtonTitle:@"Cancel" primaryButtonTitle:@"Save" destroyButtonTitle:@"Destroy" otherButtonTitles:@"Tweet", nil]; | |
actionSheet.callbackBlock = ^(RDActionSheetResult result, NSInteger buttonIndex) { | |
switch (result) { | |
case RDActionSheetButtonResultSelected: | |
NSLog(@"Pressed %i", buttonIndex); | |
break; | |
case RDActionSheetResultResultCancelled: | |
NSLog(@"Sheet cancelled"); | |
} | |
}; | |
[actionSheet showFrom:self.view]; | |
} | |
#pragma mark - | |
- (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation { | |
return (interfaceOrientation != UIInterfaceOrientationPortraitUpsideDown); | |
} | |
@end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment