美文网首页macOS
macOS 开发 报 Failed to set (conten

macOS 开发 报 Failed to set (conten

作者: 雨后天_ | 来源:发表于2019-09-27 11:47 被阅读0次

    viewcontroller 初始化不同

    IOS alloc init 会自动创建空view

    mac alloc init不会主动创建,需重写-(void)loadview方法,否则会报nib找不到的错误:

    Failed to set (contentViewController) user defined inspected property on (NSWindow): -[NSNib _initWithNibNamed:bundle:options:] could not load the nibName: HWVC1 in bundle (null).

    解决:需重写-(void)loadview方法

    -(void)loadView

    {

    NSRect frame=[[[NSApplication sharedApplication]mainWindow]frame];

    self.view=[[NSView alloc]initWithFrame:frame];

    }

    相关文章

      网友评论

        本文标题:macOS 开发 报 Failed to set (conten

        本文链接:https://www.haomeiwen.com/subject/heizectx.html