为什么我的单身人士属性不会自动完成?

时间:2011-05-19 00:23:54

标签: iphone objective-c cocos2d-iphone

Anyidea为什么自动完成功能不适用于spaceScene属性?

#import <Foundation/Foundation.h>
#import "cocos2d.h"
@class SpaceScene;


@interface SpaceSceneSingleton : NSObject 
{    
    SpaceScene *spaceScene;


}

@property (assign) SpaceScene *spaceScene;


+(SpaceSceneSingleton*)sharedSpaceSceneSingleton;
-(void) addChildToSceneWith:(CCNode *) node andWithZindex: (int) zIndex;
-(void) runAction:(CCAction*) action;
-(void) setTouchIsEnabled:(BOOL) isEnabled;
-(void) removeChild: (CCNode *) child;
@end


#import "SpaceSceneSingleton.h"


@implementation SpaceSceneSingleton
@synthesize spaceScene;

static SpaceSceneSingleton* _sharedSpaceSceneSingleton = nil;

+(SpaceSceneSingleton*)sharedSpaceSceneSingleton;
{
    @synchronized([SpaceSceneSingleton class])
    {
        if (!_sharedSpaceSceneSingleton)
            [[self alloc] init];

        return _sharedSpaceSceneSingleton;
    }

    return nil;
}



+(id)alloc
{
    @synchronized([SpaceSceneSingleton class])
    {
        NSAssert(_sharedSpaceSceneSingleton == nil, @"Attempted to allocate a second instance of a singleton.");
        _sharedSpaceSceneSingleton = [super alloc];
        return _sharedSpaceSceneSingleton;
    }

    return nil;
}

-(id)init {
    self = [super init];
    if (self != nil) {
        // initialize stuff here
    }

    return self;
}

-(void) addChildToSceneWith:(CCNode *) node andWithZindex: (int) zIndex
{
    [self.spaceScene addChild:node z:zIndex];

}


-(void) runAction:(CCAction*) action
{

//[self.spaceScene add

}

-(void) setTouchIsEnabled:(BOOL) isEnabled
{

}

-(void) removeChild: (CCNode *) child
{
}
@end

1 个答案:

答案 0 :(得分:2)

您只声明了@class SpaceScene;,因此在此范围内,除了可能存在名为SpaceScene的类之外,没有其他内容可知。也许导入SpaceScene.h有帮助。

我甚至会说这应该用警告编译。是吗?