[英]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.