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];
}