I have a problem with a UIView. This is the code:
@property ( unsafe_unretained, nonatomic) IBOutlet UIView *formView;
- (IBAction)createNewProfile:(id)sender {
[self loadDialogForm];
}
-(void) loadDialogForm{
NSLog(@"load form");
CGRect frame = self.view.bounds;
CGPoint center = CGPointMake( frame.origin.x + ceil(frame.size.width/2),frame.origin.y + ceil(frame.size.height/2));
CGFloat width = floor(1 * frame.size.width) - OFFSET * 2;
CGFloat height = floor(1 * frame.size.height) - OFFSET * 2;
_formView.frame=CGRectMake(OFFSET, OFFSET, width, height); //here the error EXC_BAD_ACCESS (code=1 address=0xe07eca10)
_formView.center=center;
[self.view addSubview:_formView];
[self performSelector:@selector(initialDelayEnded) withObject:nil afterDelay:1];
}
by a NSLog the frame of _formView is x= 0, y=0, width=300, height=390. Why this error?
Use
@property ( nonatomic,retain) IBOutlet UIView *formView;
instead of
@property ( unsafe_unretained, nonatomic) IBOutlet UIView *formView;