I suppose your containerView
property is declared with weak
attribute. If you want to have a weak
attribute to a property someone should have already retained it. Here's an example:
@property (nonatomic, weak) KGModalContainerView *containerView;
...
-(void)viewDidLoad {
[super viewDidLoad];
KGModalContainerView *myContainerView = [[KGModalContainerView alloc] initWithFrame:containerViewRect]; // This is a strong reference to that view
[self.view addSubview:myContainerView]; //Here self.view retains myContainerView
self.containerView = myContainerView; // Now self.containerView has weak reference to that view, but if your self.view removes this view, self.containerView will automatically go to nil.
// In the end ARC will release myContainerView, but it's retained by self.view and weak referenced by self.containerView
}