views:

103

answers:

1

I have a tab bar item with a UIScrollView and all the code works.

I link the UIScrollView IBOutlet in IB to a UIScrollView I placed in my View.

When I run the app and select the tab bar item I get the following error.

Terminating app due to uncaught exception 'NSUnknownKeyException', reason: '[ setValue:forUndefinedKey:]: this class is not key value coding-compliant for the key scrollView.'

I have no idea what this is. When I disconnect the ScrollView IBOutlet, then there is no crash.

Thanks

+1  A: 

You probably renamed the name of the scrollView in the code without re-connecting the outlet in Interface Builder. Double check your code to make sure the spelling is the same as in Interface Builder, and for good measure, reconnect the outlet to scrollView.

Referring to this Apple forum thread, UITabBarController has multiple UIViewControllers each of which has its own nib file assigned to it. It's up to you to make sure you change the UIViewController's class file: in the nib file for each view controller and in the tab bar controller's nib file, you also have to do the same thing by changing each view controller's nib file and class.

So all in all you have to update settings in two places: the individual nib files for the view controllers and the tab bar controller's nib file. Think of it as creating the connections/bridges between the individual nib files and the tab bar controller.

Once these connections are made, your program should have no problem accessing your scrollView outlet, since that is how it ultimately accesses it: by using key-value coding by means of your tab bar controller (at least, that's my understanding). As of now it can't because the tab bar controller is not connected properly.

Jorge Israel Peña
Nah, I checked that a few times. thanks. Still not sure what it is/
alJaree
Did you also double check the class of the tab view controller in Interface Builder? And that the File's Owner view is connected correctly? Check out this thread http://discussions.apple.com/thread.jspa?threadID=1598422 , look at the fourth-to-last post in the first page.
Jorge Israel Peña