Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #import "NewInvoiceViewController.h"
- @interface NewInvoiceViewController ()
- @end
- @implementation NewInvoiceViewController
- @synthesize clientLabel, clientPicker, clientPickerViewContainer;
- - (id)initWithNibName:(NSString *)nibNameOrNil bundle:(NSBundle *)nibBundleOrNil
- {
- self = [super initWithNibName:nibNameOrNil bundle:nibBundleOrNil];
- if (self) {
- // Custom initialization
- }
- return self;
- }
- - (void)viewDidLoad
- {
- [super viewDidLoad];
- // Do any additional setup after loading the view.
- storedClients = [NSArray arrayWithObjects:@"Joe Smith",@"John Doe",@"Bob Johnson",@"Joel Smith", nil];
- //clientPickerViewContainer.frame = CGRectMake(0, 522, 320, 261);
- }
- - (void)didReceiveMemoryWarning
- {
- [super didReceiveMemoryWarning];
- // Dispose of any resources that can be recreated.
- }
- - (IBAction)cancel:(id)sender{
- [self.navigationController dismissViewControllerAnimated:YES completion:nil];
- }
- - (IBAction)clientSelectCancel:(id)sender {
- [UIView animateWithDuration:.5 animations:^{
- CGRect clientPickerFrame = clientPickerViewContainer.frame;
- clientPickerFrame.origin.y = self.view.frame.size.height;
- clientPickerViewContainer.frame = clientPickerFrame;
- } completion:nil];
- }
- - (IBAction)clientSelectDone:(id)sender {
- [UIView animateWithDuration:.5 animations:^{
- CGRect clientPickerFrame = clientPickerViewContainer.frame;
- clientPickerFrame.origin.y = self.view.frame.size.height;
- clientPickerViewContainer.frame = clientPickerFrame;
- } completion:nil];
- }
- - (IBAction)clientPickerShowBtn:(id)sender {
- [UIView animateWithDuration:.5 animations:^{
- CGRect clientPickerFrame = clientPickerViewContainer.frame;
- clientPickerFrame.origin.y = self.view.frame.size.height - clientPickerFrame.size.height;
- clientPickerViewContainer.frame = clientPickerFrame;
- } completion:nil];
- }
- // returns the number of 'columns' to display.
- - (NSInteger)numberOfComponentsInPickerView:(UIPickerView *)pickerView
- {
- return 1;
- }
- // returns the # of rows in each component..
- - (NSInteger)pickerView:(UIPickerView *)pickerView numberOfRowsInComponent:(NSInteger)component
- {
- return [storedClients count];
- }
- -(NSString *)pickerView:(UIPickerView *)pickerView titleForRow:(NSInteger)row forComponent:(NSInteger)component {
- return [storedClients objectAtIndex:row];
- }
- -(void)pickerView:(UIPickerView *)pickerView didSelectRow:(NSInteger)row inComponent:(NSInteger)component {
- selectedClient = [storedClients objectAtIndex:row];
- }
- @end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement