Skip to content

Instantly share code, notes, and snippets.

View fernandomatal's full-sized avatar

Fernando Mata fernandomatal

View GitHub Profile
@sag333ar
sag333ar / script_1x2x3x.sh
Last active July 26, 2022 12:27
Generate 1x 2x 3x images from supplied 3x assets. Following shell-script can be used for iOS Asset catalogue.
for f in *.png
do
# Process to get File Name & 2x, 3x file names
xNAME=`echo "$f" | cut -d'.' -f1`
cp "$f" "$xNAME@3x.png"
cp "$f" "$xNAME@2x.png"
# Set proper resolution to original file
sips -s dpiHeight 72.0 -s dpiWidth 72.0 "$f"
@dlo
dlo / Auto-layout-keyboard-adjustment.md
Last active February 26, 2021 07:33
How to adjust a view's height with Auto Layout when a keyboard appears or disappears in iOS 7.

This gist outlines how to resize a view when a keyboard appears using Auto Layout (there are a bunch of code samples out there that manually adjust the view's frame, but that's just so 2013). The method I outline below works universally on both iPhone and iPad, portrait and landscape, and is pretty darn simple.

Setting Up

The first thing to do is to define our containing view controller, the view, and the bottom constraint that we'll use to adjust its size.

Here's HeightAdjustingViewController.h. We don't need to expose any public properties, so it's pretty bare.