आपकी विंडो में एनएसटीूलबारइटम वैलिडेशन प्रोटोकॉल लागू करें, देखें या दस्तावेज़ नियंत्रक।
-(BOOL)validateToolbarItem:(NSToolbarItem *)toolbarItem {
BOOL enable = NO;
if ([[toolbarItem itemIdentifier] isEqual:SaveDocToolbarItemIdentifier]) {
// We will return YES (enable the save item)
// only when the document is dirty and needs saving
enable = [self isDocumentEdited];
} else if ([[toolbarItem itemIdentifier] isEqual:NSToolbarPrintItemIdentifier]) {
// always enable print for this window
enable = YES;
}
return enable;
}
तुम भी action
या tag
निर्धारित करने के लिए क्या उपकरण पट्टी आइटम मान्य किया जा रहा है का उपयोग कर सकते हैं: प्रलेखन निम्नलिखित नमूना कोड देता है। जब भी आपका ऐप सक्रिय होता है या घटनाएं भेजी जाती हैं, आइटम अक्सर मान्य होते हैं, इसलिए वे हमेशा वैध स्थिति में रहेंगे।
स्रोत
2011-11-05 03:49:19
शानदार विचार! –
स्वच्छ और अच्छा, एक कपड़े वर्ग में है –