I am having problems with my textfield not flowing with the scene transistion. Basically my scene is transition with this call:
Scene* gs = [[[QuestionsScene alloc] initWithPage:2] autorelease];
[[Director sharedDirector] replaceScene: [SlideInRTransition transitionWithDuration:0.5 scene: gs]];
However in my init i have a textfield called here:
[answerBox setTextColor:[UIColor blackColor]];
[answerBox setTextAlignment:UITextAlignmentLeft];
[answerBox setContentHorizontalAlignment:UIControlContentHorizontalAlignmentLeft];
[answerBox setClearsOnBeginEditing:YES];
[answerBox setBorderStyle:UITextBorderStyleRoundedRect];
[answerBox setDelegate:self];
[answerBox setReturnKeyType:UIReturnKeyDone];
[answerBox setAutocapitalizationType:UITextAutocapitalizationTypeWords];
[[[Director sharedDirector] openGLView] addSubview: answerBox];
The textbox does not follow the transition, it just sits there into the next scene. Anyone have an idea on how to fix this?
-
You add the answerBox to the openGLView directly, not to the scene. So naturally when the scene changes, the answerBox is not affected.
If you use a UILabel, you cannot add it as a child on a CocosNode object, so you can't add it to your scene.
Look into using the Cocos2d label class instead. Either use Label or it's faster cousin LabelAtlas
I haven't checked how Cocos2d manages its views. Perhaps there might be another option? You can try on the cocos2d forums.
-
For this solution, i just did removed the textbox upon transition
[nameBox removeFromSuperview];
and reappear when it comes back to the scene:
[nameBox becomeFirstResponder];
which there was a smoother transition to this though.
0 comments:
Post a Comment