0

ゲームで appoxee メッセージ サービスを使用しています。

私の最初のレイヤーは「StartUpLayer」です。StartUpLayer は、StageLayer の読み込みが完了するのを待ちます..そして、UIButton が宣言されているステージ レイヤーに移動します..

ただし、私の UIButton は初めて StartUpLater に表示され、リリースされるまでそこにとどまります。この問題を解決するにはどうすればよいですか? ありがとう..

AppDelegate

- (void) AppoxeeNeedsToUpdateBadge:(int)badgeNum hasNumberChanged:(BOOL)hasNumberChanged
{

    if(badgeNum > 0)
    {
        badgeText = [NSString stringWithFormat:@"%d",badgeNum];
    }

    StageLayer *stgLayer = [[StageLayer alloc] init];


    [[AppoxeeManager sharedManager] addBadgeToView:stgLayer.AppoxeeButton  badgeText:badgeText badgeLocation:CGPointMake(0,0) shouldFlashBadge:hasNumberChanged]; 

    [UIApplication sharedApplication].applicationIconBadgeNumber = badgeNum;
}

ステージレイヤー初期化

AppoxeeButton = [[UIButton alloc] initWithFrame:CGRectMake(100,100,100,100)];
            [AppoxeeButton setBackgroundImage:[UIImage imageNamed:@"messages-button.png"] forState:UIControlStateNormal];
            [AppoxeeButton setTitle:@"" forState:UIControlStateNormal];
            [AppoxeeButton addTarget:self action:@selector(inboxPressed) forControlEvents:UIControlEventTouchUpInside];
            [[[CCDirector sharedDirector] openGLView] addSubview:AppoxeeButton];
4

1 に答える 1

0

AproxeeButtonstartUpLayer には表示されませんが、CCDirector openGL ビューには表示されます。そのため、常にすべての cocos2d ノードとレイヤーの最上位に配置されます。

startUpLayer のときになぜ表示されるのかという質問に対する答え

StageLayer *stgLayer = [[StageLayer alloc] init];AppDelegate で呼び出されるためAproxeeButton 、アプリケーションの起動後に表示されます。

于 2013-03-03T05:28:16.637 に答える