Become a MacRumors Supporter for $50/year with no ads, ability to filter front page stories, and private forums.

BadWolf13

macrumors 6502
Original poster
Dec 17, 2009
271
0
Hey guys, got a weird one here that I can't figure out. I've got a custom view XIB file, loading into the program using:

Code:
	[NSBundle loadNibNamed:@"Basic" owner:self];

	[window setContentView:basicView];

Now the view loads, and displays just fine. However, the problem occurs when fetching information from the display, or sending information to the display. Some of it works, some of it doesn't. For instance, in this section of code:

Code:
	} else if (shapeButton.indexOfSelectedItem == 1) {
		[dim1Label setStringValue:@"Width:"];
		[dim2Label setHidden:YES];
		[dim2Field setHidden:YES];

The program recognizes that shapeButton.indexOfSelectedItem does equal 1(or whatever the value is), but doesn't have any effect on the label and textField. I've checked my XIB file, and all the connections are there, but the code just isn't making the connections.

Anyone got any ideas what's wrong here?
 
Run your program. Set a breakpoint at the if. When the breakpoint is hit, are any or all of dim1Label, dim2Label, dim2Field null?

You can discover this using NSLog, too, but if you don't know how to use the debugger to set breakpoints and inspect variables, now's a good time to learn.
 
There are no nulls in any of the IBOutlets.

So how do you know that?

You're very sparse with details. Your code isn't working because you are doing _something_ wrong, and most likely it is some area in the code that you think is perfectly fine.
 
Yeah, I just figured out the problem. I've got 3 custom views, and they're swappable within the program. Some of the IBOutlets, like the three that I mentioned, exist in all 3 views. The problem I'm doing is in the applicationDidFinishLaunching where I load all 3 views from their XIB files, and thus the outlet in the code is only pointing at the last XIB loaded.

My plan at this point is to load only the currently active view, and release previous view from memory.
 
Register on MacRumors! This sidebar will go away, and you'll see fewer ads.