Skip to content

Instantly share code, notes, and snippets.

#!/bin/bash -e
# requires ImageMagick! Install via homebrew, http://brew.sh
# brew install imagemagick
# Ensure we're running in location of script.
cd "`dirname $0`"
for f in *; do
if [[ $f == *@3x* ]];
[[NSNotificationCenter defaultCenter] addObserverForName:UIKeyboardWillChangeFrameNotification object:nil queue:nil usingBlock:^(NSNotification *note) {
NSDictionary *dict = [note userInfo];
NSValue *keyboardFrame = dict[UIKeyboardFrameEndUserInfoKey];
CGRect frame = [keyboardFrame CGRectValue];
NSNumber *duration = dict[UIKeyboardAnimationDurationUserInfoKey];
double durationDouble = [duration doubleValue];
[UIView animateWithDuration:durationDouble animations:^{
self.view.frame = CGRectMake(0, frame.origin.y - self.view.frame.size.height, self.view.frame.size.width, self.view.frame.size.height);
}];
}];