Search code examples
objective-ccoordinatescgpoint

Setting a Label to a Preset Point


I would like to create some preset points for my Labels in Xcode 5. To set a Label's position, you use Label.center = CGPointMake(Xpoint,YPoint) ;.

How do I create a preset point, so there isn't a need to type the CGPointMake and the coordinates/variables.

Is there any way to just type: Label.center = A-Variable-That-Stores-X-And-Y?


Solution

  • Use something like this:

    CGPoint labelCenter = CGPointMake(xPoint, yPoint);
    label.center = labelCenter;