分离默认的NSDocument的窗口
来源:互联网 发布:淘宝店员工管理 编辑:程序博客网 时间:2024/06/06 07:02
使用XCode创建Cocoa Application时,选择“Create Document-Based Application”应用时,XCode会默认把主窗口放在Document类中。在代码膨胀后,会导致Document和Window的代码混杂在一起,不方便。
现在,我们将Window的代码放到WindowController类里,减少Document中的Window代码。
1、新建WindowController子类。
@interface WindowController : NSWindowController
2、删除Document类中的
- (NSString *)windowNibName
- (void)windowControllerDidLoadNib:(NSWindowController *)aController
3、将Document.xib改为MainWindow.xlib
4、在Document类中覆写
- (void)makeWindowControllers {
// Start off with one document window.
WindowController *windowController = [[WindowControlleralloc] initWithWindowNibName:@"MainWindow"];
[self addWindowController:windowController];
}
0 0
- 分离默认的NSDocument的窗口
- [Cocoa] 修改 NSDocument title 的两种办法
- MDI 不生成默认的子窗口
- 修改Gnome Terminal窗口的默认大小
- ubuntu 下更改窗口的默认颜色
- MFC 更改默认窗口大小的方法
- Metacity -- Gnome的默认窗口管理器
- 设置对话框窗口的“默认按钮”方法
- 更改MFC默认的窗口类#32770
- 如何默认EAS系统的最大窗口
- 如何恢复VS2015窗口的默认布局
- 恢复程序默认打开的窗口位置
- dede的栏目打开方式默认的“当前窗口打开”
- 怎样修改打开命令行窗口后的的默认路径
- 更改MFC对话框默认的窗口类名
- CMD窗口提示符前的默认路径位置
- 如何设置Ubuntu下终端窗口的默认大小
- swing 窗口回车按下时的默认执行按钮设定
- win7系统Myeclipse下切换SVN用户
- 回环接口(loop-back/loopback)
- 文本溢出显示省略号
- Vision引擎中后期处理 - 边缘光照介绍
- 回归测试概念和策略
- 分离默认的NSDocument的窗口
- AnyForWeb分享:像素!你真的了解吗?
- 多少块土地——欧拉定理
- ios之Xcode6如何手动创建空工程模板
- Nginx资源帖
- Error creating bean with name 'b2BMinShengQuery' defined in file 异常的解决
- 解决UnicodeEncodeError: 'ascii' codec can't encode characters in position 问题
- Binary Tree Inorder Traversal 二叉树中序遍历,使用堆栈,非递归
- C# - The differences between SendKeys.Send and SendKeys.SendWait