1

I had added an UILabel to a UITableviewCell. UILabel's height is same to UITableViewCell.UILabel has property text "629340.0 元" and has property numberOfLine is 1.

The Problem is Number "629340.0" and Chinese character "元" can't keep align center. Number is higher than Chinese char. The Font is "STHeitiSC-Light".

I wouldn't like to use two UILabel to solve the problem. It's inelegant.

I want to solve this problem in an UILabel. Do you have any good idea?

Startry
  • 574
  • 1
  • 4
  • 17
  • Set UILabel width as UITableViewCell's width. Than is [this](http://stackoverflow.com/questions/5722730/uilabel-align-text-to-center) not works? – AliNadi Aug 20 '15 at 08:07
  • UILabel width is equal to UITableViewCell's width, and UILabel height is equal to UITableViewCell's height. – Startry Aug 20 '15 at 08:23

1 Answers1

0
  1. You can use two separate UILabel to make them even.
  2. You can use NSAttributedString, meaning that you can give the number a smaller font size and the character bigger font size so it can get even somehow.
bolizhou
  • 1,208
  • 1
  • 13
  • 31
  • Thank you for your answer. However, I don't want to solve it by two UILabel, it's hard to control. I had try to use NSAttributedString, the effect isn't good. Maybe override drawTextInRect is a feasible solution. – Startry Sep 15 '15 at 06:58