سؤال

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?

هل كانت مفيدة؟

المحلول

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

نصائح أخرى

CGRect frame = view.center;
frame.origin.x -= 100.0;
label.frame = frame;
مرخصة بموجب: CC-BY-SA مع الإسناد
لا تنتمي إلى StackOverflow
scroll top