我也是很新的Objective-C和Xcode的,但我相信所有你需要做的是进口的“主页”类(Home.h)的头文件到外部类你想使用它。在这个外部类中,你将不得不实例化一个home类的对象。东西,可能是这样的:
/* File: "ExternalClass.h"
* This is the Super-View class of the "Home" class
*/
/* An example using Cocoa rather than Cocoa Touch */
#import <Cocoa/Cocoa.h>
// Imports a quick reference to the class without loading the classes methods
@class Home;
@interface ExternalClass : NSView {
/* This creates an object of class "Home" in which a pointer for the "Home" class can be stored
* From here all you would have to do is import the 'Home.h' file to the 'ExternalClass.m' file
* and instantiate home objects and call methods of the 'home' class within the 'ExternalClass.m' files methods
*/
Home *homeObject;
}
这声明内存要在ExternalClass.m内使用的“家”类的一个对象...你将不得不到homeObject实例变量分配类'aloc'方法如下:
homeObject = [[alloc Home] initWithSomeProperties:var1 andMoreProperties:varEtc];
根据您在整个程序中如何使用对象,您可能必须在ExternalClass.m init方法内初始化该变量。 – Matt