|
|
#1 |
|
How to use check buttons
I am a developer newbie and I want when I check button when its on a on states to do this:
Code:
-(IBAction)Purge:(id)sender{
NSString* path = [[NSBundle mainBundle] pathForResource:@"TurnOn 2d Dock" ofType:@"scpt"];
NSURL* url = [NSURL fileURLWithPath:path];NSDictionary* errors = [NSDictionary dictionary];
NSAppleScript* appleScript = [[NSAppleScript alloc] initWithContentsOfURL:url error:&errors];
[appleScript executeAndReturnError:nil];
}
Code:
NSString* path = [[NSBundle mainBundle] pathForResource:@"TurnOff 2d Dock" ofType:@"scpt"];
NSURL* url = [NSURL fileURLWithPath:path];NSDictionary* errors = [NSDictionary dictionary];
NSAppleScript* appleScript = [[NSAppleScript alloc] initWithContentsOfURL:url error:&errors];
[appleScript executeAndReturnError:nil];
Also check out my software on: https://www.macupdate.com/developers/profile/ Last edited by SandboxGeneral; Mar 6, 2013 at 12:14 PM. Reason: Added code tags |
|
|
|
0
|
|
|
#2 |
|
Just set an action for the checkbox, and look at its value to determine which way to go.
__________________
MacBook Pro / OS X Mountain Lion (10.8.3) / Xcode 4.6 / [various (much) older stuff keeping dust off the shelves] |
|
|
|
0
|
|
|
#3 |
|
|
0
|
|
|
#4 |
|
|
0
|
|
|
#5 | |
|
Quote:
but that only applies for changing labels. I want to do a different action when its in off or no state |
||
|
|
0
|
|
|
#6 |
|
Add an IBOutlet for your NSSwitchButton. Connect it to your NSSwitchButton. Add in a conditional statement,
Code:
if (switchOutlet.state == NSOnState) {
// your on code here
} else {
// your off code here
}
(I'm assuming you already know enough C/Obj-C to figure out your on code and off code yourself.)
__________________
Battery Status - On the Mac App Store
The only app that'll estimate when your wireless devices will need their batteries changed. Like it on Facebook! |
|
|
|
0
|
|
|
#7 | |
|
Quote:
|
||
|
|
0
|
|
|
#8 | |
|
Quote:
|
||
|
|
0
|
|
|
#9 | |
|
Quote:
|
||
|
|
0
|
|
|
#10 | |
|
Quote:
|
||
|
|
0
|
|
|
#11 |
|
|
0
|
|
|
#12 | |
|
Quote:
- standardUserDefaults - boolForKey: - setBool:forKey: I just want guidance on how to set the check button to save its on or off state when the user quits the app. Thank you anyone can help me? |
||
|
|
0
|
|
|
#13 | |
|
Quote:
|
||
|
|
0
|
![]() |
|
«
Previous Thread
|
Next Thread
»
| Thread Tools | Search this Thread |
| Display Modes | |
|
|
All times are GMT -5. The time now is 12:52 AM.







Linear Mode
