XCode无法识别NSLabel [英] XCode doesn't recognize NSLabel

查看:294
本文介绍了XCode无法识别NSLabel的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试为我的osx应用程序创建一个NSLabel但是XCode没有认识到NSLabel类型是有效的,并建议我尝试NSPanel。

I'm trying to create a NSLabel for my osx app however XCode is not recognizing the type "NSLabel" as valid and is suggesting I try "NSPanel" instead.

在头文件中,我有以下导入:

In the header file I have the following imports:

#import <Cocoa/Cocoa.h>
#import <AppKit/AppKit.h>

我该如何解决这个问题?我需要导入另一个文件吗?

How do I fix this? Is there another file I need to import?

推荐答案

没有标签类( NSLabel 。你必须使用 NSTextField ,删除挡板并使其不可编辑:

There is no label class (NSLabel) on OS X. You have to use NSTextField instead, remove the bezel and make it non editable:

[textField setBezeled:NO];
[textField setDrawsBackground:NO];
[textField setEditable:NO];
[textField setSelectable:NO];

这篇关于XCode无法识别NSLabel的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆