title: Popup UIPickerView (iphone)
body: <p>I am creating a <code>textField</code> which when clicked <code>UIPickerView</code> comes up.
  When I run this code there is an error:
  <code>Thread 1:Profram received signal:"SIGABRT"</code>.</p>
  
  <p>I am quite new on iPhone development, but the person in charge is away and I am taking on a project.</p>
  
  <p>If you could let me know what's wrong with this...</p>
  
  <p>This is how the <code>ViewController.h</code> looks like:</p>
  
  <pre><code>#import &lt;UIKit/UIKit.h&gt;
  
  @interface ViewController : UIViewController {
  
  IBOutlet UIPickerView *picker;
  IBOutlet UITextField *text;
  
  }
  
  
  - (IBAction)showPicker:(id)sender;
  
  
  @end
  </code></pre>
  
  <p>and <code>ViewController.m</code>:</p>
  
  <pre><code>#import "ViewController.h"
  @implementation ViewController
  - (void)didReceiveMemoryWarning
  {
      [super didReceiveMemoryWarning];
      // Release any cached data, images, etc that aren't in use.
  }
  
  #pragma mark - View lifecycle
  
  - (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.
       // e.g. self.myOutlet = nil;
   }
  
  - (void)viewWillAppear:(BOOL)animated
  {
      [super viewWillAppear:animated];
  }
  
  - (void)viewDidAppear:(BOOL)animated
  {
      [super viewDidAppear:animated];
  }
  
  - (void)viewWillDisappear:(BOOL)animated
  {
      [super viewWillDisappear:animated];
  }
  
  
  - (void)viewDidDisappear:(BOOL)animated
  {
  [super viewDidDisappear:animated];
  }
  
  - (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation
  {
  // Return YES for supported orientations
  if ([[UIDevice currentDevice] userInterfaceIdiom] == UIUserInterfaceIdiomPhone) {
      return (interfaceOrientation != UIInterfaceOrientationPortraitUpsideDown);
  } else {
      return YES;
  
  
  }
  }
  
  - (void)showPicker {
  
  [UIView beginAnimations:nil context:NULL];
  [UIView setAnimationDuration:0.4];
  [UIView setAnimationDelegate:self];
  picker.center = CGPointMake(160, 240);
  [UIView commitAnimations];
  
  
  if (!self.navigationItem.rightBarButtonItem) {
      UIBarButtonItem *doneButton = [[UIBarButtonItem alloc]     initWithBarButtonSystemItem:UIBarButtonSystemItemDone target:self action:@selector(done:)];
      [self.navigationItem setRightBarButtonItem:doneButton animated:YES];
    //  [doneButton release];
  }   
  }
  
  
  - (void)hidePicker {
  
  [UIView beginAnimations:nil context:NULL];
  [UIView setAnimationDuration:0.4];
  [UIView setAnimationDelegate:self];
  picker.center = CGPointMake(160, 240);
  [UIView commitAnimations];
  
  
  [self.navigationItem setRightBarButtonItem:nil animated:YES];
  }
  
  
  - (void)done:(id)sender {
  
  [self hidePicker];
  
  [self.navigationItem setRightBarButtonItem:nil animated:YES];
  }
  
  
  - (BOOL)textFieldShouldBeginEditing:(UITextField *)textField {
  
  [self showPicker];
  
  return NO;
  }
  </code></pre>