Skip to content

Instantly share code, notes, and snippets.

@braking
braking / GifAnimation.m
Created May 3, 2013 12:46
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.
#import "ViewController.h"
@interface ViewController ()
@property (nonatomic, weak) IBOutlet UIImageView *starImageView;
@end
@implementation ViewController
- (void)viewDidLoad
@braking
braking / CollapsibleToolbar.m
Created May 3, 2013 13:20
The code for an iOS toolbar that animates up and down with a button touch or pan gesture.
#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 / KeyboardNotification.m
Last active November 14, 2018 18:46
Adjust content insets of a tableview when keyboard opens.
- (void)viewDidLoad
{
[super viewDidLoad];
[[NSNotificationCenter defaultCenter] addObserver:self
selector:@selector(keyboardWillShow:)
name:UIKeyboardWillShowNotification
object:nil];
[[NSNotificationCenter defaultCenter] addObserver:self
selector:@selector(keyboardWillHide:)
@braking
braking / ExplodingTabBar.m
Created May 23, 2013 11:58
A custom UITabBar with a big unique center button that animates 3 buttons out of the center from any view.
#import "CustomTabBarViewController.h"
@interface CustomTabBarViewController ()
@property (nonatomic, assign) BOOL buttonsExpanded;
@end
@implementation CustomTabBarViewController
-(void) addCenterButtonWithImage:(UIImage*)buttonImage highlightImage:(UIImage*)highlightImage
{
@braking
braking / AutolayoutAnimations.m
Created August 6, 2013 00:41
The implementation file for an example of animating a UIView using autolayout constraints.
#import "ViewController.h"
@interface ViewController ()
@property (nonatomic, weak) IBOutlet UIView *viewToAnimate;
@property (nonatomic, assign) BOOL containerIsOpen;
@end
@implementation ViewController
@braking
braking / ViewControllerContainment.swift
Last active August 16, 2017 02:39
Convenience extension on UIViewController for containing child view controllers.
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`.
*/