• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

ios - OS X : Scene is unreachable due to lack of entry points

[复制链接]
菜鸟教程小白 发表于 2022-12-12 14:00:35 | 显示全部楼层 |阅读模式 打印 上一主题 下一主题

这个问题可能与 iOS 相关,但不是 OS X。三天来,我一直在努力尝试使用 Storyboard将 NSViewNSViewController 嵌入到 NSView 中。

使用 .xib 或 .nib 可以正常工作按下下一个按钮时,它会在容器 View 中显示 customView1 或 customView2。

nib example

尝试使用 Storyboard 不起作用。事实上,我对如何连接、嵌入、调用、召唤或请求 customView1customView2 让自己进入 Container View 没有任何概念或线索。

storyboard example

似乎我无法访问它自己的 View Controller 之外的任何东西!?!

正常工作功能示例(来自 .nib):

example



Best Answer-推荐答案


这是一种方法。

您可以将两个“容器 View ”对象添加到主视图 Controller ,作为顶级对象,并将它们连接到 Controller 中的 NSView 导出。这将自动创建两个新的 View Controller 场景,Embed 从容器 View 到 subview Controller 。

Interface Builder

您的 View Controller 现在引用了两个内部 NSView,您可以随意操作它们。

如果您需要对 subview Controller 的引用,请为每个 Embed segue 分配一个 Storyboard标识符并实现 -prepareForSegue:sender:

- (void)prepareForSegueNSStoryboardSegue*)segue senderid)sender
{
    if ([segue.identifier isEqual"Embed1"])
    {
        _innerController1 = segue.destinationController;
    }
    else if ([segue.identifier isEqual"Embed2"])
    {
        _innerController2 = segue.destinationController;
    }
}

除了 segues,您可以为每个内部 View Controller 分配一个 Storyboard标识符,并在 Storyboard的代码中实例化它们:

_innerController1 = [self.storyboard instantiateControllerWithIdentifier"InnerController1"];

您还可以自由混合 Storyboard 和 NIB,因此您可以在单独的 NIB 中设计内部 View 并在代码中实例化它们。

关于ios - OS X : Scene is unreachable due to lack of entry points,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/28269459/

回复

使用道具 举报

懒得打字嘛,点击右侧快捷回复 【右侧内容,后台自定义】
您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

关注0

粉丝2

帖子830918

发布主题
阅读排行 更多
广告位

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap