Skip to content

Instantly share code, notes, and snippets.

@braking
braking / ViewControllerContainment.swift
Last active Aug 16, 2017
Convenience extension on UIViewController for containing child view controllers.
View ViewControllerContainment.swift
extension UIViewController {
/**
Convenience function to add a child view controller to self.
This will send the proper notifications to the child view controller
and add the child view controller's view to `self.view`.
- parameter child: The view controller that should be contained in `self`.
*/
@braking
braking / AutolayoutAnimations.m
Created Aug 6, 2013
The implementation file for an example of animating a UIView using autolayout constraints.
View AutolayoutAnimations.m
#import "ViewController.h"
@interface ViewController ()
@property (nonatomic, weak) IBOutlet UIView *viewToAnimate;
@property (nonatomic, assign) BOOL containerIsOpen;
@end
@implementation ViewController
@braking
braking / ExplodingTabBar.m
Created May 23, 2013
A custom UITabBar with a big unique center button that animates 3 buttons out of the center from any view.
View ExplodingTabBar.m
#import "CustomTabBarViewController.h"
@interface CustomTabBarViewController ()
@property (nonatomic, assign) BOOL buttonsExpanded;
@end
@implementation CustomTabBarViewController
-(void) addCenterButtonWithImage:(UIImage*)buttonImage highlightImage:(UIImage*)highlightImage
{
@braking
braking / KeyboardNotification.m
Last active Nov 14, 2018
Adjust content insets of a tableview when keyboard opens.
View KeyboardNotification.m
- (void)viewDidLoad
{
[super viewDidLoad];
[[NSNotificationCenter defaultCenter] addObserver:self
selector:@selector(keyboardWillShow:)
name:UIKeyboardWillShowNotification
object:nil];
[[NSNotificationCenter defaultCenter] addObserver:self
selector:@selector(keyboardWillHide:)
@braking
braking / CollapsibleToolbar.m
Created May 3, 2013
The code for an iOS toolbar that animates up and down with a button touch or pan gesture.
View CollapsibleToolbar.m
#import "ViewController.h"
@interface ViewController ()
@property (nonatomic, weak) IBOutlet UIView *toolbarContainer;
@property (nonatomic, weak) IBOutlet UIView *touchZone;
@property (nonatomic, weak) IBOutlet UIView *buttonContainer;
@property (nonatomic, weak) IBOutlet UIButton *collapseButton;
@property (nonatomic, assign) BOOL toolbarIsOpen;
@property (nonatomic, assign) BOOL toolbarIsAnimating;
@braking
braking / GifAnimation.m
Created May 3, 2013
iOS Animated Gif implementation code. This is the contents of a ViewController.m that has an image view that should toggle a set of images back and forth like a gif.
View GifAnimation.m
#import "ViewController.h"
@interface ViewController ()
@property (nonatomic, weak) IBOutlet UIImageView *starImageView;
@end
@implementation ViewController
- (void)viewDidLoad
You can’t perform that action at this time.