是否可以使用 Interface Builder 设计 NSTableView 单元格? (不适用于 iOS 应用程序)

发布于 2024-09-14 17:24:19 字数 112 浏览 5 评论 0原文

是否可以使用 Interface Builder 设计 NSTableView 单元格? 我知道如果您的项目适用于 iOS,这实际上是可能的,但不知何故,如果适用于 Mac OS X,IB 不会渲染单元容器。

Is it possible to design NSTableView cells using Interface Builder?
I know this is actually possible if your project is for iOS but somehow IB does not render the cell container if its for Mac OS X.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

逆光下的微笑 2024-09-21 17:24:19

我不确定艾米是否给出了这个答案,因为以前无法​​做到这一点,但是这可以在界面生成器上很容易完成。

可以使用 苹果文档。甚至还有一个不错的示例,您可以从参考站点下载。

Im not sure if Amy gave that answer when this couldn't be done before, but this can be done quite easily on interface builder.

It can be done using view-based table view cells (instead of cell based) shown in the apple docs. There's is even a decent example you can download from the reference site.

要走干脆点 2024-09-21 17:24:19

不会。它在 iOS 上可行的原因是 UITableViewCells 继承自 UIView。 Interface Builder 允许您通过在视图中放置其他视图来布局视图。

在桌面上,出于性能原因,当 NextStep 在 16mhz 计算机上运行时,NSCell 并不继承自 NSView。 Mac 上的单元格没有自己的坐标系或子视图层次结构,因此在 Interface Builder 中编辑它没有意义:您不能在其中放入其他视图!

因此,要制作自定义单元格,您需要使用 CoreGraphics 等绘图函数来绘制所有内容。你不能直接放入 NSImageView,你必须直接绘制图像。

No. The reason it's possible on iOS is because UITableViewCells inherit from UIView. Interface Builder lets you lay out views by putting other views within them.

On the desktop, for performance reasons from back when NextStep ran on 16mhz computers, NSCell does not inherit from NSView. A cell, on the Mac, does not have its own coordinate system or subview hierarchy, so it doesn't make sense to edit it in Interface Builder: you couldn't put other views within it!

So to make a custom cell, you need to draw everything with drawing functions such as CoreGraphics. You can't just drop in an NSImageView, you have to draw the image directly.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文