Register FAQ / Rules Forum Spy Search Today's Posts Mark Forums Read
Go Back   MacRumors Forums > Apple Systems and Services > Programming > Mac Programming

Reply
 
Thread Tools Search this Thread Display Modes
Old Feb 20, 2012, 12:20 AM   #1
BadWolf13
macrumors 6502
 
Join Date: Dec 2009
IBOutlets and IBActions, some working, some not

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?
BadWolf13 is offline   0 Reply With Quote
Old Feb 20, 2012, 12:25 AM   #2
chown33
macrumors 603
 
Join Date: Aug 2009
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.
chown33 is offline   0 Reply With Quote
Old Feb 20, 2012, 06:15 PM   #3
BadWolf13
Thread Starter
macrumors 6502
 
Join Date: Dec 2009
There are no nulls in any of the IBOutlets.
BadWolf13 is offline   0 Reply With Quote
Old Feb 20, 2012, 07:12 PM   #4
gnasher729
macrumors G5
 
gnasher729's Avatar
 
Join Date: Nov 2005
Quote:
Originally Posted by BadWolf13 View Post
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.
gnasher729 is offline   0 Reply With Quote
Old Feb 20, 2012, 07:45 PM   #5
BadWolf13
Thread Starter
macrumors 6502
 
Join Date: Dec 2009
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.
BadWolf13 is offline   0 Reply With Quote

Reply
MacRumors Forums > Apple Systems and Services > Programming > Mac Programming

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Similar Threads
thread Thread Starter Forum Replies Last Post
How do you declare IBOutlets? MacMan988 iPhone/iPad Programming 1 Apr 2, 2014 09:45 AM
Subclassing a subclass - question regarding IBOutlets and IBActions moonman239 iPhone/iPad Programming 1 Sep 27, 2013 08:15 PM
iPhone: iPhone 5 / iPad 3 with Airport Extreme and WPA2 not working, WPA working ManuCH iOS 6 7 Aug 13, 2013 08:20 PM
Resolved: Target action methods v delegates v IBActions MickeyT iPhone/iPad Programming 6 Jan 10, 2013 06:02 PM
XCode 4.4 and IBOutlets+Actions Meldar Mac Programming 14 Sep 7, 2012 01:32 PM

Forum Jump

All times are GMT -5. The time now is 10:18 AM.

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

Mobile Version | Fixed | Fluid | Fluid HD
Copyright 2002-2013, MacRumors.com, LLC