New To Mac-Forums?

Welcome to our community! Join the discussion today by registering your FREE account. If you have any problems with the registration process, please contact us!

Get your questions answered by community gurus Advice and insight from world-class Apple enthusiasts Exclusive access to members-only contests, giveaways and deals

Join today!

 
Start a Discussion
 

Mac-Forums Brief

Subscribe to Mac-Forums Brief to receive special offers from Mac-Forums partners and sponsors

Join the conversation RSS
OS X - Development and Darwin Discussion and questions about development for Mac OS X.

[help]how to dealing with checkbox in Xcode


Post Reply New Thread Subscribe

 
Thread Tools
sleetq8

 
Member Since: Feb 24, 2009
Posts: 2
sleetq8 is on a distinguished road

sleetq8 is offline
hello everyone,

i search in deferent book about how to dealing with the checkbox but i don`t understood it

so can anyone help me.. and tell me how to dealing with it..?
how to know if it true or false..?

and please if you have a good website tutorial send the link to me or write it here..
QUOTE Thanks
MattMcN

 
Member Since: Jul 11, 2009
Posts: 1
MattMcN is on a distinguished road

MattMcN is offline
Well, the checkbox in Interface Builder is really just a type of NSButton, and in Xcode's documentation, it tells us a button can have either two or three states, On (true), Off (false) and sometimes Mixed.

Now, how do we find out what state the button is in? First, create an connection between your code and your NIB with this.
Code:
IBOutlet NSButton *buttonName;
Then, in your code, you can use a simple if statement to fine out what state the button is in, like so.

Code:
if ( [button state] == NSOnState ) {
    //The button is checked...
} else {
    //The button is not checked...
}
You can see a very simple example in the attached project. Open the Console and when you press Update, you'll see if the button is on or not.
Attached Files
File Type: zip CheckTest.zip (54.7 KB, 67 views)
QUOTE Thanks

Post Reply New Thread Subscribe


« Log in as >console without changing login method | equivalent of gpupdate for OS X 10.5.7? »
Thread Tools

Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts
BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off
Forum Jump

Similar Threads
Thread
Thread Starter
Forum
Replies
Last Post
Xcode, Subversion, and directory behaviour Reinderien OS X - Development and Darwin 1 03-10-2009 12:50 PM
Carbon framework on XCode Rafi Shalom OS X - Development and Darwin 1 04-17-2008 02:14 PM
Xcode 1.5 alejandrico OS X - Development and Darwin 0 06-03-2006 06:56 PM
New Xcode plug-in helps developers reuse code Murlyn OS X - Development and Darwin 0 11-10-2003 01:16 PM

All times are GMT -4. The time now is 05:44 PM.

Powered by vBulletin
Copyright ©2000 - 2014, Jelsoft Enterprises Ltd.
X

Welcome to Mac-Forums.com

Create your username to jump into the discussion!

New members like you have made this community the ultimate source for your Mac since 2003!


(4 digit year)

Already a member?