【问题标题】:Display text (string) in the storyboard在情节提要中显示文本(字符串)
【发布时间】:2014-12-12 19:34:54
【问题描述】:

我想在故事板文件的 NSTextView Outlet 中显示一些文本(字符串),但它不起作用。我不确定我是否使用了最好的方法。选择的方法“insertText”是否正确?插座连接是否正确?故事板是否支持 NSTextView 类?

非常感谢任何帮助。

ViewController.h

@interface ViewController : NSViewController
@property (unsafe_unretained) IBOutlet NSTextView *closerText;
@end

ViewController.c

@implementation ViewController
@synthesize closerText;

- (void)viewDidLoad {
    [super viewDidLoad];

[closerText insertText:@"Hello World"];

}
@end

【问题讨论】:

    标签: objective-c storyboard nstextview outlet


    【解决方案1】:

    确保 NSTextView 连接到 closeText IBOutlet。 insertText 是正确的函数。

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2017-10-27
      • 2014-03-21
      • 1970-01-01
      • 1970-01-01
      • 2019-09-29
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多