objective-c – NSTextView不调用controlTextDidChange:
发布时间:2020-12-16 06:59:06 所属栏目:百科 来源:网络整理
导读:我有一个类(“TextEditorViewController”),里面有一个NSTextView(“textView”)对象.我已将它与我的.xib文件中的NSTextView连接起来.这是我的.h文件: #import Foundation/Foundation.h@interface TextEditorViewController : NSObject { IBOutlet NSTextVi
我有一个类(“TextEditorViewController”),里面有一个NSTextView(“textView”)对象.我已将它与我的.xib文件中的NSTextView连接起来.这是我的.h文件:
#import <Foundation/Foundation.h> @interface TextEditorViewController : NSObject { IBOutlet NSTextView *textView; // connected in MainMenu.xib IBOutlet NSTextField *displayCharacters; // connected in MainMenu.xib } @end 这是我的.m文件: #import "TextEditorViewController.h" @implementation TextEditorViewController - (void)applicationDidFinishLaunching:(NSNotification *)aNotification { NSLog(@"applicationDidFinishLaunching called"); // printed to the debugger [textView setDelegate:(id)self]; } - (void)controlTextDidChange:(NSNotification *)obj { NSLog(@"controlTextDidChange called"); // don't printed to the debugger ??? [displayCharacters setIntValue:[[textView string] length]]; } @end 但是当我在NSTextView中更改文本时,它不会调用controlTextDidChange :! 谢谢你的回答! =) 解决方法
它在重建新项目中的文件后起作用.看起来像文件管理配置问题.
(编辑:李大同) 【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容! |