May 16, 2018

UILabel With Padding

Sometimes you want to add padding to a UILabel. But doing so requires a parent view that adds the actual padding. This subclass fixes this by adding a property for edgeInsets and takes care of the necessary overrides to deal with the layouts. I haven’t run in to any issues with this. Let me know if you use it and improve it! // MIT License applies. import UIKit /** A `UILabel` subclass that provides a way of adding padding to the label.

Read more...
January 25, 2018

Hiding the UITabBar of a UITabBarController

For some reason, that is beyond my imagination, there is no public API for hiding the UITabBar of a UITabBarController on iOS. Sure there’s the .hidesBottomBarWhenPushed. But I never get that to work the way I expect it to. And furthermore, it does not help when I want to hide the bar after a push, or at any arbitrary point in time. So I wrote up this little extension on UITabBarController that adds a method for toggling the tab bar’s visibility.

Read more...