tags:

views:

375

answers:

3

Is there a simple way to place a detail disclosure icon on a UIButton? I'm using a navigation controller and I want a button press to push a new view on the stack, so I thought a detail disclosure icon would be appropriate, but I haven't found a straightforward way to do that yet.

What I have in mind is something like the "When Timer Ends" button in the Timer subview of the Clock app.

+2  A: 

That "When Timer Ends" "button" isn't really a button, but a heavily styled UITableViewCell.

Of course you can still implement it as a button. Just create 2 images containing the disclosure indicator, and use -setBackgroundImage:forState:.

KennyTM
Where do I get the disclosure indicator image?
Ben Collins
@Ben: Unfortunately, you need to draw it yourself.
KennyTM
Grab a screenshot of one from the Simulator, use Photoshop (or similar)'s Levels tool to make the image black-on-white, then use that (inverted) as a mask for whatever color of indicator you want.
Noah Witherspoon
A: 

Just create a UIButton and set its buttonType property to UIButtonTypeDetailDisclosure!

Zack
A: 

No, I don't think this is what Ben was looking for. I think he wants a button with a title AND a disclosure button on it, which is what i am also looking to implement somehow. Simply changing the buttonType to UIButtonTypeDetailDisclosure, would provide you ONLY a disclosure image-button, without the possibility of adding any text on it. What i did was to use a custom button, with an image next to it, to make it look like the disclosure image is actually part of the buton.

Other useful suggestions would be appreciated

This ought to be posted as a comment to @Zack's answer, not as an answer on it's own.
Ben Collins