tags:

views:

3214

answers:

2

Is it possible to change the styling of iPhone native buttons? For example, I'd like to use a smaller font size for part of the button text, and larger for another - something like

<small>pick a</small><big>color</big>

I'd also like to use buttons that form a right-arrow shape instead of being rectangular. Something like:

---------------------------------
\ Color  \   Size    \    Shape  \
/        /           /           /
----------------------------------

Any of that possible?

+1  A: 

I don't think you can do it easily. You'll probably have to subclass UISegmentedControl and override a bunch of methods. To get differently sized fonts on the button text, you'll have to create several UILabels as subviews and give each one the appropriate text and font size, and then lay them out. To get the right-arrow shape, you'll need to override the drawRect: method to draw the control's background.

Adam Rosenfield
+2  A: 

The easiest option is to use Rounded Rect Buttons with custom images, unfortunately this will not meet your resizable text requirement (unless you have images for each size).

  • Add a Rounded Rect Button to the View
  • In the Inspector:
    -switch the Type to "Custom"
    -set Background to the image of your new button
    -place the text in "Title"

Be sure to use Background for you button image if you want to use the button's text property (Title)

Paxic