0

을적인 Cocos2D 내 게임에 appoxee 메시지 서비스를 사용하고 있습니다 ..있는 UIButton 잘못된 계층에 나타납니다 -

내 첫 번째 층 StageLayer 로딩이 완료 될 때까지 "StartUpLayer"StartUpLayer 기다리는입니다 .. 어디 레이어를 무대에 올라가면 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]; 

답변

0

AproxeeButton apeears하지 startUpLayer에 있지만 CCDirector OpenGL을보기에 appers. 그래서 모든 cocos2d 노드와 레이어의 맨 위에 allways가있을 것입니다.

startUpLayer이

StageLayer *stgLayer = [[StageLayer alloc] init];은 AppDelegate에 호출되는 경우가 표시되는 이유 질문에 대답, 그래서 AproxeeButton은 응용 프로그램이 시작 후에 표시됩니다.

+0

사실 .. 나는 [[[CCDirector sharedDirector] openGLView] addSubview : AppoxeeButton];을 init에서 -onEnterTransitionDidFinish' 메소드로 이동하고 문제가 해결되었습니다. – user1526474