I have a view controller called GobanVC. It's adding a subview to do a magnification effect. That works fine, but when I call removeSuperview to get rid of it, I get an unrecognized selector error:
2010-08-26 10:10:04.014 GoGrinder[4257:207] -[GobanVC _invalidateSubviewCache]: unrecognized selector sent to instance 0x5a2f540
2010-08-26 10:10:04.016 GoGrinder[4257:207] *** Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '-[GobanVC _invalidateSubviewCache]: unrecognized selector sent to instance 0x5a2f540'
GobanVC is a UIViewController subclass, not a view, so I'm not sure why it's receiving this message. I'm adding the subview like this:
if(magnifier == nil)
{
magnifier = [[MagnifierView alloc] initWithFrame:gobanView.bounds];
magnifier.viewref = gobanView;
[gobanView addSubview:magnifier];
}
gobanView is a UIView IBOutlet.
In touchesEnded I try to remove the subview like this:
if(magnifier != nil)
{
[magnifier removeFromSuperview];
[magnifier release];
magnifier = nil;
}
Any ideas? It seems like _invalidateSubviewCache should be sent to the parent of the view, which is a UIView. I don't see why the VC is getting called instead.
Update:
gobanVC.view is the parent of gobanView. I added a child view using IB, and gobanView is the IBOutlet it is connected to.