Create UIView through code and add events in iphone
<p>I have created a UIView and added label to it and latter assign it to Controller.
Now whenever I click on my View it shows me  "EXC_BAD_ACCESS”.</p>

<p>Below is my code.</p>

<pre><code>//create a UIView in App Delegate  
UIView *viewPtr = [[[UIView alloc] initWithFrame:frmRect] autorelease];  

//created a Button and added to UIView  
UIButton *btnPointer = [UIButton buttonWithType:UIButtonTypeRoundedRect];  
btnPointer.frame = cgframe; // provides both a position and a size  
[btnPointer setTitle:btnLabelText forState:UIControlStateNormal];  
[btnPointer addTarget:self action:@selector(generate:) forControlEvents:UIControlEventTouchUpInside];
[viewPtr addSubview:btnPointer];  

//Now need to add this UIView to a controller  
viewController.view = viewPtr;  
</code></pre>

<p>I am able to display the button on the Form but when I click on the form or the button I get 
"EXC_BAD_ACCESS”.</p>
