Created
November 29, 2012 00:57
-
-
Save mteece/4165964 to your computer and use it in GitHub Desktop.
UIViewController UIBarButtonItem title and add to left/right bar buttons array.
This file contains hidden or 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
| #import "RecentRequestsViewController.h" | |
| #import "AppDelegate.h" | |
| @interface RecentRequestsViewController () | |
| @end | |
| @implementation RecentRequestsViewController | |
| #pragma mark - | |
| #pragma mark Class initializers. | |
| -(id) initWithNibName:(NSString *)nibNameOrNil bundle:(NSBundle *)nibBundleOrNil | |
| { | |
| self = [super initWithNibName:nibNameOrNil bundle:nibBundleOrNil]; | |
| if(self) | |
| { | |
| // Custom initialization. | |
| self.title = @"Recent Requests"; | |
| UIBarButtonItem *recentRequestsButton = [[UIBarButtonItem alloc] initWithTitle:@"Recent Requests" | |
| style:UIBarButtonItemStylePlain | |
| target:self | |
| action:@selector(recentRequestsButtonPressed)]; | |
| NSArray *navButtons = [[NSArray alloc] initWithObjects:recentRequestsButton, nil]; | |
| self.navigationItem.leftBarButtonItems = navButtons; | |
| } | |
| return self; | |
| } | |
| - (void)viewDidLoad | |
| { | |
| [super viewDidLoad]; | |
| // Do any additional setup after loading the view, typically from a nib. | |
| } | |
| - (void)didReceiveMemoryWarning | |
| { | |
| [super didReceiveMemoryWarning]; | |
| // Dispose of any resources that can be recreated. | |
| } | |
| - (void)dealloc | |
| { | |
| // Dealloc any resources. | |
| } | |
| #pragma mark - | |
| #pragma mark Class methods | |
| -(void)recentRequestsButtonPressed | |
| { | |
| // Handle SEL here such as transferring to another view controller. | |
| } | |
| @end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment