Topics

#154: Return of the UIKit B-sides! πŸ“Ό

Topics

Today we're continuing our look at lesser-known UIKit features. Let's get started:

Fixing Unwanted Undo Prompts

Ever been testing an app and have an unwanted "Undo" prompt appear? This can be dynamically enabled or disabled with a property on UIApplication:

UIApplication.sharedApplication()
  .applicationSupportsShakeToEdit = false

Customizing Tab Bar Items Layout

We can use the UITabBar's itemPositioning property to control whether tab bar items use a "fill" or "centered" layout:

let tabBarController = UITabBarController()
tabBarController.tabBar.itemPositioning = .Centered

Significant Time Changes

The applicationSignificantTimeChange app delegate function lets us know when things like daylight savings time begin.

Refresh Control Labels

UIRefreshControl has an attributedTitle property we can use to show a nice little bit of text when a user pulls to refresh:

refreshControl.attributedTitle = attributedStringForRefreshControl()

In-App Dictionary View Controller

This one is awesome.

We can use a reference library view controller to display a nicely formatted screen depicting the definition of a term in our app. Neat!

let vc = UIReferenceLibraryViewController(term: "awesome")
showViewController(vc, sender: nil)