Ah, so you want to put UILabels in the middle of the container view (both horizontally and vertically)?
I rephrased my answer, so it will make more sense to future readers.
My code assumes you have 3 IBOutlets installed:
UIView *containerView;
You can simply set the label frame after by assigning text and calling sizeToFit .
This first line positions the UILabel points, the only change is that the y coordinate is half the containerView subtracts half the height itself.
points.frame = CGRectMake(points.frame.origin.x, (containerView.frame.size.height / 2) - (points.frame.size.height / 2), points.frame.size.width, points.frame.size.height);
To put overall accordingly - let's say that there is a distance of 6 between the quantity and the total marks:
int space = 6; overall.frame = CGRectMake(overall.frame.origin.x, points.frame.origin.y + points.frame.size.height + space, overall.frame.size.width, overall.frame.size.height);
After reading your comments, I think you are after this decision. If you want both UILabels displayed in the middle; subtract (overall.frame.size.height / 2) + (space / 2) from the y points value in the same way (with the code at number 2 below):
int space = 6; points.frame = CGRectMake(points.frame.origin.x, ((containerView.frame.size.height / 2) - (points.frame.size.height / 2)) - ((overall.frame.size.height / 2) + (space / 2)), points.frame.size.width, points.frame.size.height); overall.frame = CGRectMake(overall.frame.origin.x, points.frame.origin.y + points.frame.size.height + space, overall.frame.size.width, overall.frame.size.height);
The endpoint will produce a result similar to this image. Since you can see that the blue line is half the entire image, and intersects the black rectangle (which is placed around the two labels) at its midpoint. Hope this is what you were.

source share