繁体   English   中英

XCode 4的代码完成.h文件中的方法

[英]XCode 4's code completion for methods in the .h file

在Xcode 3中,我可以在实现( .m )文件中编写我的方法; 然后将相同的方法添加到接口( .h )文件。 此时,Xcode 3为.m文件中编写的方法完成了代码。 可悲的是,Xcode 4并没有像Xcode 3那样编写完整的方法。 有没有其他人遇到过这种情况,是否有这种情况的选择?

一个例子:

实现.m文件可能如下所示:

#import "Foundation, MyClass.h and stuff"

@implementation MyClass

-(void)mySampleMethod { NSLog(@"mySampleMethod"); }

@end

接口.h文件可能如下所示:

#import "Foundation and stuff"

@interface MyClass : MySuperClass {

 }

-(void)myS /* in Xcode 3 the code completion would now pop up with the 'mySampleMethod' from the .m, in Xcode 4 this does not happen */ ampleMethod; /* So I either copy/paste, or write the method */

@end

Xcode 4对代码完成和交叉引用的索引使用了LLVM编译器,这使得它只能呈现在您尝试使用它们的上下文中有效的完成。

这种(大大提高)精度的一个缺点是,在这种情况下你正在寻找的完成是不可用的。

当然,请记住,在Objective-C中,只有一个类实际暴露给另一个类需要在类的头文件中声明。

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM