|
|
| Welcome to the Mac Forums forums. Please read the FAQ if you have questions. Register to participate. |
|
|||||||
| TouchArcade.com - iPhone Game Reviews and News |
![]() |
|
|
Thread Tools | Search this Thread |
|
|
#1 |
|
macrumors member
Join Date: Jun 2008
|
Multiple Views in a NIB; How to Access ?
This may just be me having a bad day, but I am hitting a wall here.
I have started a new empty project (I am trying out some theories before taking it back to the main development) I have two views in the .nib ViewA and ViewB In my ViewController I have two UIView declerations as IBOutlet Code:
@interface iDirecTVViewController : UIViewController {
UIView *viewA;
UIView *viewB;
}
// Object Exposure
@property (nonatomic, retain) IBOutlet UIView *viewA;
@property (nonatomic, retain) IBOutlet UIView *viewB;
NIBViewA -> view That would be the default startup view for the controller. Build/Run in simulator, everything fine. Then if I assign: NIBViewB -> viewB Upon the start of the Interface Builder, I get an unexpected error and can't run. Debugger isn't showing me much, unless I am just not seeing the issue. This happens as well if I assign NIBViewA ->viewA Any ideas on what is wrong? In a nutshell, I want to have multiple views in a NIB file, and assign them to object variables in the code so I can access them when different events occur. Like I said, could just be a bad day thing so please accept my apologizes if this is a simple trivial thing, simple searches didn't turn up any other posts. |
|
|
|
|
|
#2 |
|
macrumors 6502a
Join Date: Sep 2008
|
This should work. If you control-click on File's Owner or any other item in the xib window a little black window opens showing you the connections. Check this for all the views and the File's Owner to see if all your connections are correct.
|
|
|
|
| PhoneyDeveloper |
| View Public Profile |
| Find More Posts by PhoneyDeveloper |
|
|
#3 | |
|
Thread Starter
macrumors member
Join Date: Jun 2008
|
Quote:
All the views are pointing to their correct variables. I was able to snag this error message from the console: Code:
"*** Terminating app due to uncaught exception 'NSUnknownKeyException', reason: '[<UIViewController 0x44e8b0> setValue:forUndefinedKey:]: this class is not key value coding-compliant for the key viewA.' |
|
|
|
|
|
|
#4 |
|
Thread Starter
macrumors member
Join Date: Jun 2008
|
Well, I managed to get it to work.
Here is what I did. Everything in the .xib for the ViewController, and the ViewController files was fine. Where I had to make a change, was in the MainWindow.xib Even though my view for the NAVIGATION CONTROLLER was set to the proper .xib file, and it was loading the correct "view" It was pointing to the generic class UIViewController Once I changed it to the specific viewControllerTest class, all is fine now. |
|
|
|
![]() |
| Thread Tools | Search this Thread |
| Display Modes | |
|
|