views:

34

answers:

2

I have created a View controller with some methods I need to use often in different aplications. It works like a charm if I use it directly but when I try to create another UIViewController that extend my class I cannot access self.view anymore. This is the init method of the original class:

- (id)initWithNibName:(NSString *)nibNameOrNil bundle:(NSBundle *)nibBundleOrNil   slideFrom:(HalfViewControllerType) from {
     self.slideFrom = from;
    if ((self = [super initWithNibName:nibNameOrNil bundle:nibBundleOrNil])) {
         CGRect viewScreen = [self.view bounds];
        [self moveTo:startPoint inDuration:0.0];
    }
    return self;
}

At the point of retrieving [self.view bounds] I got an EXC_BAD_ACCESS. Even hacking the values manually it then fail to all the other self.view like transform animation and so on.

The call to create the view is this, but it never got after the init method:

 SelectViewController *sVC = [[SelectViewController alloc] initWithNibName:@"SelectViewController" bundle:nil slideFrom:top];
 [sVC setDelegate:self];
 [self.view addSubview:sVC.view];
 [sVC slideIn];
 [sVC release];

Any help on understanding what I am doing wrong would be really appreciated. Francesco.

A: 

did you set the view outlet in your nib?

Sander Backus
On IB the Outlet is hocked up with File's Owner view. The nib however is the one of the extended class, while the self.view I cannot acces is on the extender (the super class). I hope this help.
cescofry
So your file owner's class is set to: SelectViewController and it has a link for the view property to a UIView?
Sander Backus
A: 

I couldn't understand what was happening, so I re-wrote everything and now works. I can just guess I was releasing something I shouldn't have.

cescofry