Search code examples
iosobjective-clabelcgrectmake

Move UILabel's center up in UIView.


I am trying to create a UILabel and I am setting it to the center of the view using label.center = view.center. But I want to move it up by 100 pixels.

How would I go by doing this?

Something like, label.frame = CGRectMake(current-x, 100, 42, 21);

Is this possible? Keep x the same but change the y?


Solution

  • Do this : label.center = CGPointMake(view.center.x, view.center.y - 100);.