This is such a common requirement in iOS development, and it was always something that had to be done purely in code (or using images - yuck!). Now it's incredibly easy to preview his kind of thing in Interface Builder, there's absolutely no excuse for not using it.
Here's the code:-
import UIKit
...