【发布时间】:2015-02-03 16:15:57
【问题描述】:
在 Mac OS X 中,我正在尝试将自定义 NSView 添加到我的视图控制器(我正在使用情节提要)
这就是我创建视图类的方式:
@interface Card1View : NSView
@end
和.m文件:
@implementation Card1View
-(instancetype)initWithFrame:(NSRect)frame
{
self = [super initWithFrame:frame];
if (self) {
[[NSBundle mainBundle] loadNibNamed:@"Card1View" owner:nil topLevelObjects:nil];
}
return self;
}
@end
添加我正在使用的视图
NSView *view = [CardsProvider getCard:self.uxCardsView.frame];
[self.uxCardsView addSubview:view];
但它不起作用,我尝试了一些修改但没有成功。任何想法我做错了什么?
【问题讨论】:
标签: macos nsview osx-yosemite