I am creating a alert badge using UILabel using following code:
[label setText:@"67"];
UIFont * font = [UIFont systemFontOfSize:11];
[label setFont:font];
[label sizeToFit];
[label setTextAlignment:NSTextAlignmentCenter];
[label setBackgroundColor:[UIColor yellowColor]];
[label setTextColor:[UIColor whiteColor]];
label.layer.cornerRadius = label.frame.size.height/2;
Everything is fine but vertical alignment of text is not correct. Its more close to top edge. How can I align text in vertical center of UILabel?
I read about ascender and descender properties of UIFont, can I use them to align text in vertical center of UILabel.