Implementing a Custom UIActionSheet

This week the need arose to have a more powerful UIActionSheet that went beyond having just buttons. My initial reaction was to simply subclass UIActionSheet and add whatever was needed.  But an argument arose at to whether this was the best approach since Apple clearly indicates in the UIActionSheet Class Reference that

UIActionSheet is not designed to be subclassed, nor should you add views to its hierarchy. If you need to present a sheet with more customization than provided by the UIActionSheet API, you can create your own and present it modally with presentViewController:animated:completion:.

Continue reading

Implementing Dynamic Type Support

iOS 7 introduced typographically heavy and complex designs that pushed solutions using string drawing and WebKit (both based on Core Graphics) to the limit. Going down to Core Text (an Advanced Unicode layout engine) may be overkill to simply render a label. Apple’s answer was Text Kit which is a fast, modern, object-oriented text layout and rendering engine which is built on Core Text and is tightly integrated with UIKit. In fact, all of Apple’s UI text-based controls like UILabel, UITextField, UITextView, and even UIWebView were rebuilt on top of Text Kit. This should provide seamless animations in UITableViews and even UICollectionViews.

This week I had the opportunity to get into Text Kit. The app I am working on has some views which are text heavy and to some have a small, hard to read, text. The answer was Text Kit’s Dynamic Type that provides designed type styles that are not only optimized for legibility but also user selectable through the Accessibility Settings on the iPhone. Getting this to work was easy and I started by building a prototype so as to know what I needed to add to the app. I’ll describe step-by-step what I did to build the prototype and although I have the prototype posted on GitHub I recommend you follow along step-by-step. Continue reading