MacOS 上的 NSCell(比较 NSButton 和 NSButtonCell )
来源:互联网 发布:淘宝新开店铺图标 编辑:程序博客网 时间:2024/05/31 20:51
- NSButton 和 NSButtonCell 的继承关系
- Cell和Control 的关系
本文选摘自 关于NSCell : http://cocoa.venj.me/blog/about-nscell/
NSButton 和 NSButtonCell 的继承关系
- NSButton的继承关系是:NSButton -> NSControl -> NSView -> NSResponder -> NSObject。应该说,是一个很长的继承链了。
- NSButtonCell的继承关系是:NSButtonCell -> NSCell -> NSObject。
比之NSButton,少了两层继承关系。光凭这一点大致就能够解释为什么Cell的性能比Control高很多了。
Cell和Control 的关系
NSCell是控件的UI显示部分。
NSButton 和 NSMatrix 能够为 NSButtonCell 提供一个控制视图,用来实现Cell的显示。
不过 NSMatrix 需要直接操作 NSButtonCell 对象,而 NSButton 则不需要。因为它已经“封装”了所有 NSButtonCell 的同名方法。也就是说,对NSButton调用方法(不是所有的方法),实际上是对NSButtonCell调用方法,调用的时候,我们甚至可以无需知道NSButtonCell的存在。
所以在Interface Builder中,NSButton总是和NSButtonCell同时存在,在Interface Builder里,NSButton和NSButtonCell的Inspector里的属性也基本相同。
阅读全文
0 0
- MacOS 上的 NSCell(比较 NSButton 和 NSButtonCell )
- NSButtonCell inside custom NSCell
- MacOS 和iOS 开发细节上的不同(OC)
- NSButton
- macOS上的readelf和objdump的替换
- [Cocoa]_[初级]_[鼠标移动到NSButton上面和移开NSButton时,控件背景颜色的变化]
- 在MacOS和iOS上使用VPN的几个问题(MTU太大导致打不开网页)
- 在MacOS上homebrew的安装和使用
- 【syslog】macos上的syslog
- macOS上的SIP(System Integrity Protection)
- macOS上安装gerrit和jenkins
- 在centos和macos上安装zsh
- [MacOS]MacOs的HomeBrew命令安装和常用工具(不断更新中)
- 我的MacOS上的软件
- OSVersion 在 MONO MacOS 上的Bug?
- macos X在acer5572上的安装
- MySQL在MacOS上的安装记录
- xgboost4j 在linux macOs上的配置
- H5中date组件的格式化
- 中国部署LoRaWAN最佳频段
- GBDT(Gradient Boosting Decision Tree 梯度提升/迭代树)算法
- 更快更低耗!Spread表格控件V11 CTP发布,性能巨大提升
- Softmax 回归模型
- MacOS 上的 NSCell(比较 NSButton 和 NSButtonCell )
- 前台、后台ui的选择
- 1222:排序
- 权限系统--敢不敢从建工程开始
- H5 牛牛源码 带后台控制的
- 模板template
- 【LeetCode】669 Trim a Binary Search Tree
- 使用Toolbar + DrawerLayout实现侧滑和改变toolbar左边按钮颜色
- Android -Logcat:you must supply a layout_width attribute