Can I have text centered in Editbox?

Can I have text centered in Editbox?
0

Can I have text centered in Editbox?

No, currently EditBox doesn’t support text alignment, I will add it in the next release. Keep tuning. :smile:

Does it support text alignment now ? :smile:

Still cant align it :blush:

Now You can align only the text but not the placeholder xD

is it added yet?

If this is for iOS/Android, you can subclass the cocos2d classes, (such as UIEditBoxImplIOS_objc in iOS) and add some logic for the alignment.

Example:

...
CCUISingleLineTextField *textField = [[[CCUISingleLineTextField alloc] initWithFrame:self.frameRect] autorelease];

***textField.textAlignment = NSTextAlignmentCenter;***

If you subclass you can add a flag, or set the alignment at runtime, not hardcoded as the example I just gave.