[英]Adding custom nsview
In Mac OS X I'm trying to add custom NSView to my view controller (I'm using storyboard) 在Mac OS X中,我试图将自定义NSView添加到我的视图控制器中(我使用情节提要)
That's how I create view class: 这就是我创建视图类的方式:
@interface Card1View : NSView
@end
and .m file: 和.m文件:
@implementation Card1View @implementation Card1View
-(instancetype)initWithFrame:(NSRect)frame
{
self = [super initWithFrame:frame];
if (self) {
[[NSBundle mainBundle] loadNibNamed:@"Card1View" owner:nil topLevelObjects:nil];
}
return self;
}
@end
to add this view I'm using 添加我正在使用的视图
NSView *view = [CardsProvider getCard:self.uxCardsView.frame];
[self.uxCardsView addSubview:view];
But it doesn't work, I tried some modifications but without success. 但这不起作用,我尝试了一些修改,但没有成功。 Any ideas what am I doing wrong?
有什么想法我做错了吗?
请尝试加载笔尖代码移到里面ViewDidLoad
的呼叫NSViewController
。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.