gpt4 book ai didi

objective-c - NSTextView 不调用 controlTextDidChange :

转载 作者:太空狗 更新时间:2023-10-30 03:54:54 25 4
gpt4 key购买 nike

我有一个类(“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:!为什么?

谢谢解答! =)

最佳答案

它在新项目中重建文件后工作。似乎是文件管理配置问题。

关于objective-c - NSTextView 不调用 controlTextDidChange :,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/9566659/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com