Stretching a 1-pixel image to make a resizeable border or shadow

This comes up a lot, so I’m positing an image to illustrate the idea.

Here’s my related stack overflow answer, which uses the technique to make a shadow around a UITableView section of arbitrary size and shape.

This entry was posted in Uncategorized. Bookmark the permalink. Post a comment or leave a trackback: Trackback URL.

2 Comments

  1. Greg Lincoln
    Posted January 15, 2012 at 8:52 am | Permalink

    Android has a “file format” (really just an image with some magic lines at the edges) called 9-patch that allows you to set this up automagically. It’s neat!

    http://developer.android.com/guide/developing/tools/draw9patch.html

  2. Robert Beverly
    Posted January 15, 2012 at 1:12 pm | Permalink

    Interesting… here’s a link. I guess that’s what they use for their resizeable buttons. Thanks Greg :)

Post a Comment

Your email is never published nor shared. Required fields are marked *

*
*

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>