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

trey5498

macrumors regular
Original poster
Jun 16, 2008
191
0
I have used the IDE to assign a checkbox to an outlet to check its value.

However I can't figure out what to use for it. I have tried NSObject or NSButton because there is no NSCheckBox however I get warnings of: "Warning: 'NSObject' may not respond to 'isEqualToString.'"

Here is the Code:

Code:
header file:

NSObject *cse211djq

.m file

if([cse211djq isEqualToString:@"CSE-211-DJQ"] == YES) {


Where did I screw up? Eventually I will be setting it to an array which is for a later date.
 

Eraserhead

macrumors G4
Nov 3, 2005
10,434
12,250
UK
In the header file it should be IBOutlet NSButton *myCheckbox or whatever. Then you can link that up to the interface in Interface Builder.

Then in the implementation, you want to use if([myCheckbox state]==NSOnState) to see if the checkbox is checked or not.


PS Why have you used such rubbish un-Cocoa-like names for your stuff?
 

Eraserhead

macrumors G4
Nov 3, 2005
10,434
12,250
UK
I'm not a programmer (and I'm about to prove it), but in most db's & such, particularly as read into spreadsheets that don't support the box, checkboxes are TRUE/FALSE conditions. Does that help any?

In Cocoa they use YES and NO for true/false conditions normally, its just one of those things.

But in this case my answer is right :).
 
Register on MacRumors! This sidebar will go away, and you'll see fewer ads.