Skip to content
This repository has been archived by the owner on Mar 11, 2021. It is now read-only.

CCLabel won't center #33

Closed
Krumelur opened this issue Oct 14, 2014 · 2 comments
Closed

CCLabel won't center #33

Krumelur opened this issue Oct 14, 2014 · 2 comments

Comments

@Krumelur
Copy link

The code below works fine when using CCLabelTtf - the label will be centered both horizontally and vertically. However with CCLabel, horizontal alignment won't work. The label is all the way to the left side.

Interesting: CCTextAlignment.Center puts it all the way to the left, CCTextAlignment.Left (!) centers it perfectly and CCTextAlignment.Right places the label half way off the screen to the left.

var label = new CCLabel ("Bildschirm berühren!", "Times New Roman", 44)
            {
                Position = this.VisibleBoundsWorldspace.Center,
                Color = CCColor3B.White,
                HorizontalAlignment = CCTextAlignment.Center,
                VerticalAlignment = CCVerticalTextAlignment.Center,
                AnchorPoint = CCPoint.AnchorMiddle,
            };
            this.AddChild (label);
@kjpou1
Copy link
Contributor

kjpou1 commented Oct 14, 2014

Use the IgnoreAnchorPointForPosition = true because you are already setting the position which is Center of the VisbleBoundsWorldspace.

see answer here: http://forums.xamarin.com/discussion/comment/81874/#Comment_81874

@kjpou1
Copy link
Contributor

kjpou1 commented Oct 14, 2014

@Krumelur Thanks for providing an example for the problem.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants