Reputation: 5834
how to change font size of label without changing font family in xcode6 ?I am using following line of code:
lblMain.font = [UIFont systemFontOfSize:22];
Upvotes: 1
Views: 2953
Reputation: 2822
NSString *fontName = lblMain.font.fontName;
CGFloat fontSize = lblMain.font.pointSize;
[lblMain setFont:[UIFont fontWithName:fontName size:NEWSIZE]];
Upvotes: 2
Reputation: 10108
Here's an example:
lblMain.font = [UIFont fontWithName:@"HelveticaNeue" size:22];
Or - you can even use the current font:
lblMain.font = [lblMain.font fontWithSize:22];
Upvotes: 6
Reputation: 9842
Use following code, if you just want to change font size keeping the same font family:
lblMain.font = [UIFont fontWithName:lblMain.font.fontName size:22.0f];
OR
You can also use this code:
lblMain.font = [lblMain.font fontWithSize:22.0f];
Upvotes: 1