UILabel Align Text to center
Here is a sample code showing how to align text using UILabel:
label = [[UILabel alloc] initWithFrame:CGRectMake(60, 30, 200, 12)];
label.textAlignment = NSTextAlignmentCenter;
You can read more about it here UILabel
From iOS 6 and later UITextAlignment
is deprecated. use NSTextAlignment
myLabel.textAlignment = NSTextAlignmentCenter;
Swift Version from iOS 6 and later
myLabel.textAlignment = .center