Mark Mark - 1 year ago 57
Swift Question

How can I vertically align my status bar item text?

enter image description here

Left one on the picture is the date and time from Apple and one is my application one. As you may see the text of my application appears lower than the Apple one. Which doesn't look pretty. How can this be resolved?

self.statusBarItem.image = nil
self.statusBarItem.button?.imagePosition = .NoImage
self.statusBarItem.button?.title = "Sun 5 Jun 13:35"

Answer Source

You could do it in offset. You cannot do it like this since it needs to be done on the status item button bar.

button.frame = CGRectMake(0.0, 0.5, button.frame.width, button.frame.height)