Skip to content


Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Some categories to help solve common needs for UIKit components
Objective-C Ruby
branch: master

Fetching latest commit…

Cannot retrieve the latest commit at this time

Failed to load latest commit information.


Some categories to help solve common needs for UIKit components.



Provides a simple one-line factory for making bar button items as image buttons. Patterned after existing constructors of UIKit.


Provides a method to remove all action/event pairs associated with a control (like a button).


Provides methods to enable/disable gesture-based page turning in a UIPageViewController. For instance, if you want to disable page turning while displaying something else on screen temporarily.


Provides methods to force a portrait or landscape orientation for a view controller's view.


Provides methods to perform an operation (specified as an Objective-C 2.0 block) on all subviews or all superviews of a given view. Also provides a convenience method to enable or disable all UIControls in the hierarchy.


Removing all actions on a UIButton:

#import "UIControl+Convenience.h"

    [myButton removeAllTargetActionEvents];

Running a block of code on all subviews in a view hierarchy:

#import "UIView+SubviewRecursion.h"

@implementation MyFancyViewController

    [self.view runBlockOnAllSubviews:^(UIView *view) {

        view.backgroundColor = [UIColor greenColor];

    [self.view disableAllControlsInViewHierarchy];


Forcing an interface rotation to portrait/landscape:

This uses CGAffineTransform to rotate the UI to the nearest portrait/landscape and sets the status bar orientation.

Sets the status bar to UIInterfaceOrientationPortrait / UIInterfaceOrientationPortraitUpsideDown / UIInterfaceOrientationLandscapeRight / UIInterfaceOrientationLandscapeLeft based on a default, but if the device is already being held in the new orientation, will switch to the appropriate one (In other words, the user shouldn't get an upside-down UI)

#import "UIViewController+ForcedRotation.h"

- (IBAction)rotateLandscape:(id)sender 
    [self rotateViewToLandscape];

- (IBAction)rotatePortrait:(id)sender 
    [self rotateViewToPortrait];


  • Drag .h and .m files to your project
  • Or, add project as dependency to your own project
  • Import appropriate headers whenever you need to use them


I first created these categories because I find myself having common needs across apps that have complex or interesting interfaces. For instance, if you want to disable buttons on a page view controller while the page curl/flip animation is happening, because users may accidentally tap a button that's on the "back" of a page mid-animation.

Something went wrong with that request. Please try again.