简体   繁体   中英

How do I delegate the textStorageDidProcessEditing notification?

I try to make it as short as possible, please don't get me wrong if I provide not enough information:

I got a NSTextView in a document-based cocoa application which is the result of a tutorial by Apple for programming a text editor within 15 minutes . In my "PureBasicDocument.m" implementation I got the textDidChange method which is called every time I change something in the NSTextView. I also got the method for the textStorageDidProcessEditing notification, but it is never called. How do I invoke it? I am sure I simply just forgot to assign outlets or something like that. But staring and looking over and over again at the textView and the window for their outlets did not bring me further. I am clueless. Better than nothing, here's at least the header file ("PureBasicDocument.h") of my document class for now:

#import <Cocoa/Cocoa.h>

@interface PureBasicDocument : NSDocument {
    IBOutlet NSTextView *textView;
    NSAttributedString *mString;
}

- (NSAttributedString *) string;
- (void) setString: (NSAttributedString *) value;
- (void) textDidChange: (NSNotification *) notification;
- (void) textStorageDidProcessEditing: (NSNotification *) notification;

@end

I apologize again if I did not use the "delegate" (and further) expressions right, I am still completely new to Objective-C and programming on a Mac in general.

right click the pureBasicDocument Object in the MainMenu.xib.You can see the outlets(textView). from there you can make the connection to the respective tableview. make sure whether you have include the delegate

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM