1

How can I create a button in a Today widget like the "edit button" in the picture below? Is there a quick and standard way to do this or must I subclass a button and override it's draw method to draw a filled and rounded rectangle with transparency and background-only highlighting when touched down?

I am trying to find the best way to create exactly the same visuals for a button, instead of trying to imitate and match behaviour of it. Is it possible?

enter image description here

frankish
  • 6,738
  • 9
  • 49
  • 100

2 Answers2

0

Segmented controls are a default within Xcode. It does most of the heavy lifting for you.

The UIKit Interfact Catalog in the iOS developer library should be helpful for you.

Within Xcode:

You will find segmented controls within the Interface Builder, in the Segmented Control section of the Attributes Inspector.

From here you can begin to build the visual styling and tie it to your code.

This should point you in the right direction.

More from apple is here: Segmented Control in the iOS developer library

They have great documentation, be sure you always seek that out.

JohnSalzarulo
  • 1,046
  • 10
  • 16
  • Unfortunately, I couldn't get the exact look of the "Edit Button" in the picture, with `UISegmentedControl`. – frankish Sep 26 '14 at 04:15
0

From some quick tinkering I've got a UIButton that looks relatively close, you can tinker it some more to get it perfect. Here's a picture:

image

My buttons settings (the top one) has a height of 28, corner radius of 3, font color of black, and a background color of white with 31% Opacity. In the picture I was using text size of 15 but 13 or 14 looks a lot more accurate. I used the answers on this question as a reference point on how to create the rounded buttons.

Hope this helps some!

Community
  • 1
  • 1
TyloBedo
  • 495
  • 2
  • 12