Register FAQ/Rules Forum Spy Search Today's Posts Mark Forums Read

Welcome to the Mac Forums forums. Please read the FAQ if you have questions. Register to participate.

 
Go Back   Mac Forums > Apple Software > iPhone Programming
TouchArcade.com - iPhone Game Reviews and News

Reply
 
Thread Tools Search this Thread  
Old Oct 8, 2008, 05:39 PM   #1
Fontano
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;
Via Interface Builder, I am able to assign:
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.
Fontano is offline   Reply With Quote
Old Oct 8, 2008, 08:03 PM   #2
PhoneyDeveloper
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 is offline   Reply With Quote
Old Oct 9, 2008, 10:15 AM   #3
Fontano
Thread Starter
macrumors member
 
Join Date: Jun 2008
Quote:
Originally Posted by PhoneyDeveloper View Post
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.
Yep, double checked there and in the Identity windows.
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.'
Quick google searches, come up with that I am missing the definition in the header file, but it is there. I typically try to write my header files and link back to them, rather then draw the UI in IB and have it generate the matching header. Maybe I will try that next just to see if it does something different.
Fontano is offline   Reply With Quote
Old Oct 9, 2008, 10:30 AM   #4
Fontano
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.
Fontano is offline   Reply With Quote

Reply

Mac Forums > Apple Software > iPhone Programming

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Forum Jump


All times are GMT -5. The time now is 09:03 AM.

Mac News | Mac Rumors | iPhone Game Reviews | iPhone Apps

Powered by vBulletin® Version 3.6.10
Copyright ©2000 - 2009, Jelsoft Enterprises Ltd.
Copyright 2002-2009, MacRumors.com, LLC