title: iphone add view controller as subview
body: <p>I would like to show a modal view but don't want to use the standard methods because they don't let me animate the subview as I like.
  I <em>tried</em> the fowlloing code:</p>
  
  <pre><code>EventsCalendarController *calController = [[EventsCalendarController alloc] init];
  calController.modalPresentationStyle = UIModalPresentationFormSheet;
  
  [self presentModalViewController:calController animated:YES];
  
  [calController release];
  </code></pre>
  
  <p>but the problem is that I would like to show it using some animation, so I am using the following code along with [UIView beginAnimation] etc...</p>
  
  <pre><code>EventsCalendarController *calController = [[EventsCalendarController alloc] init];
  calController.modalPresentationStyle = UIModalPresentationFormSheet;
  
  [self.view addSubview:calController.view];
  
  
  [calController release];
  </code></pre>
  
  <p>The problem is that whenever I call the following code from the 'EventsCalendarController' I get an exception:</p>
  
  <pre><code>- (IBAction)btnClose_TouchUpInside:(id)sender {
      [self.view removeFromSuperview];
  }
  </code></pre>
  
  <p>here is the exception:</p>
  
  <pre><code>*** Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '-[__NSCFType btnClose_TouchUpInside:]: unrecognized selector sent to instance 0x7029d60'
  </code></pre>
  
  <p>How can I solve/overcome this problem? Thank you.</p>
  
  <p><strong>UPDATE</strong>:
  Solved: I found the following code on GitHub: <a href="https://github.com/horaceho/iphone-custom-dialogbox" rel="nofollow">https://github.com/horaceho/iphone-custom-dialogbox</a>
  It is a complete example with very few code to write. I did not find the original author, so I am just linking to the code...</p>