Harry Richardson


Code

HRGridView

HRGridView is a container view that can be split in to a grid with a set number of rows and columns. All subviews would have a value set to specify which row or column they should be placed in.

The view is quite useful for setting out images, buttons and more. It is much lighter than the UICollectionView, and much faster than auto-layout when dealing with many subviews.

I have recently added a new class to the library that is similar to the LinearLayout class in the Android SDK - the idea is to easily add subviews that will be of equal sizes. Margins can still be set, which is great for creating a quick row of buttons.

HRModalStylePushSegue

HRModalStylePushSegue begun as an educational challenge for myself. Since I solved it, I have decided to release it! The class allows the developer to change the transition for pushing a view controller onto the navigation controller stack. This particular class uses a modal-style translation transition, although it can be easily changed with whatever transform you like.

The class works by:

  1. Creating a snapshot of the navigation controller view and placing the image in a layer
  2. Presenting a temporary view controller with its view layer set to the source snapshot (to prevent any flickering in the following step(s))
  3. Pushing the destination view controller on to the navigation controller stack
  4. Wait for a split second - I attempted to find a better method for this, but if there is no delay, on some occasions the navigation controller view won’t be created in time and the destination view snapshot won’t look right.
  5. Take a snapshot of the navigation controller view (which will be the destination view now that it has been pushed on to the top of the stack)
  6. Remove the temporary view controller’s view
  7. Animate the transition

HRMessageBarView

HRMessageBarView is a notification bar similar to the stock iOS notification bar that appears when the user receives a push or local notification. It is compatible on both iOS 7 and 8, and on iPhone and iPad.

The control itself was built mainly in Core Graphics and allows the developer to have two “title” strings, so that on smaller devices title-one will get truncated, while title-two will remain complete; for example, the message bar could show: ‘This file with a long name…’ was uploaded. The more important part of this message is the “was uploaded” text, so the file name gets truncated instead.