xcode6 - How to programmaticlly center verticaly a label in swift ? -


I have a problem with the label; I'm not sure about standing this label:

  textRect = NSMakeRect (newX, newY, 400, 400) to textTextContent = NSString (string: "label") let textStyle = NSMutableParagraphStyle.defaultParagraphStyle (). As mutableCopy () NSMutableParagraphStyle textStyle.alignment = NSTextAlignment.CenterTextAlignment  

horizontaly easy, but verticaly I find a way to do it coudn't ..

Thanks for the help, and sorry for my english!

I think that any alignment like qualities to have container Use the view to stop the label to focus the center.

Enter image details here

You have the form of obstacles program can add:

  containerView.addConstraints ([NSLayoutConstraint (item: ContainerView, featuring: .CenterX, relatedBy: .Equal, toItem: labelView, featuring: KCenterX, multiplier: 1.0, continued : 0.0), NSLayoutConstraint (item: ContainerView, featuring: .CenterY, relatedBy: .Equal, toItem: labelView, featuring: KCenterY, multiplier: 1.0, constant: 0.0)])  

Comments

Popular posts from this blog

winforms - C# Form - Property Change -

javascript - amcharts makechart not working -

java - Algorithm negotiation fail SSH in Jenkins -