随着大量的Xcode新手的涌入,我相信会有很多Xcode的技巧和技巧可以分享。
你的呢?
随着大量的Xcode新手的涌入,我相信会有很多Xcode的技巧和技巧可以分享。
你的呢?
当前回答
alt -左&右转到行尾/开始。这与ctrl -左&右一起移动到下一个大写字母或换行字。这两个帮我省了不少时间
其他回答
我已经为NSObject, UIView和UIViewController创建了自己的文件模板,所以当我创建新类时,这些文件都设置了私有部分,并在init和dealloc中记录类的地址。
示例(命名为'test'的NSObject派生类将像这样开始):
//=====================================================
// Private Interface
//=====================================================
@interface test (private)
@end
//=====================================================
// Public Implementation
//=====================================================
@implementation test
- (void)dealloc {
NSLog(@">>> Dealloc: test [0x%X]", self);
[super dealloc];
NSLog(@"<<< Dealloc: test");
}
- (id) init
{
self = [super init];
if(self) {
NSLog(@">>> Alloc: test [0x%X]", self);
}
return self;
}
@end
//=====================================================
// Private Implementation
//=====================================================
@implementation test (private)
@end
这方面有很多可用的资源,例如Cocoa dev:设计自己的Xcode项目模板。
切换到头文件/源文件
选项命令⌘向上箭头↑ 查看>切换到头文件/源文件
在。m和。h文件之间切换。
在Xcode 4中,这是ctrl⌘向上箭头↑
Ctrl + 2:访问当前文件中的方法和符号的弹出列表。
这是非常有用的,因为有了这个快捷键,你可以完全使用键盘浏览文件。当你到达列表时,开始输入字符,列表就会选择你要找的符号。
在拆分窗口时按住“选项”以垂直而不是水平拆分窗口。
使用类浏览器显示继承的方法
Apple's API reference documentation does not show methods inherited from a superclass. Sometimes, though. it's useful to be able to see the full range of functionality available for a class -- including a custom class of your own. You can use the Class Browser (from the Project menu) to display a flat or hierarchical list of all the classes related to a current project. The upper pane on the right hand side of the browser window shows a list of methods associated with the object selected in the browser. You can use the Configure Options sheet to select "Show Inherited Members" to show inherited methods as well as those defined by the selected class itself. You click the small book symbol to go to the corresponding documentation.