views:

19

answers:

0

I have used IB to create a NIB that will be loaded as a subview into my apps main view. That main view is a UIImagePickerController (its called visorViewController) and does not have a nib of it's own - it is complex it and was coded by hand.

My subview is its own class - newSuperBlob.m/.h/.xib, and it is a subclass of UIView. Using a very simple nib file (just the UIView with the background color set) I can get the subview to show up in the visorView. However, when I add one IBOutlet (called closeButton) and associated IBAction (closeButtonPressed, which just prints a log statement) I throw the following error: Terminating app due to uncaught exception 'NSUnknownKeyException', reason: '[ setValue:forUndefinedKey:]: this class is not key value coding-compliant for the key closeButton.

The nib is wired as follows: File Owner has its class set to "newSuperBlob"; New Super Blob (thats the view) has its class set to "newSuperBlob"; First Responder - UIResponder. A right-click on the rounded-rect button that is closeButton shows: under 'Events' Touch Up Inside is wired to New Super Blob closeButtonPressed: ; under 'Referencing Outlets' closeButton is wired to File's Owner.

This is the code I am adding the subview with:

NSArray *bundle = [[NSBundle mainBundle] loadNibNamed:@"newSuperBlob" owner:self options:nil];
   for (id object in bundle) {
    if ([object isKindOfClass:[newSuperBlob class]])
     superBlob = (newSuperBlob *)object;
   } 

   [self.view addSubview:superBlob];

My guess is that the error is related to visorViewController not having closeButton. However, I am not sure how to either wire the nib (IB is not a strong suit of mine) or make the correct code changes in visorViewController to get closeButton and the associate touchUpInside events to the newSuperBlob object called superBlob.

related questions