Skip to content

Instantly share code, notes, and snippets.

@acwright
Created August 22, 2011 23:10
Show Gist options
  • Save acwright/1163883 to your computer and use it in GitHub Desktop.
Save acwright/1163883 to your computer and use it in GitHub Desktop.
Cocoa Menu Item Title Toggle
# pragma mark menu
- (BOOL)validateMenuItem:(NSMenuItem *)menuItem {
if ([menuItem action] == @selector(toggleRuler:)) {
if ([canvasView rulersVisible]) {
[menuItem setTitle:@"Hide Ruler"];
} else {
[menuItem setTitle:@"Show Ruler"];
}
}
return YES;
}
# pragma mark ruler
- (void)toggleRuler:(id)sender {
[canvasView toggleRuler:sender];
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment