5

I'm trying to mimic the default emboss that automatically gets applied to navigationItem.title, as well as many other UIKit controls.

As seen in this screenshot's title ("Table Cells"):

Emboss title
(source: quicksnapper.com)

I'm essentially trying to add 2 UILabels to the navigationItem.titleView, however the UILabels just show up as flatly drawn and it really just doesn't feel/look right :P

I've thought about playing with shadows, but that would only give the embossed look (if even that) on one side of the label.

Any ideas would be great!

Thanks

Glorfindel
  • 21,988
  • 13
  • 81
  • 109
Sahil
  • 1,268
  • 12
  • 19

3 Answers3

16

Yeh thanks! I just figured it out:

where postTitle is set to a white colour, i just added a darkGray shadow with a vertical offset of 1px.

[postTitle setShadowColor:[UIColor darkGrayColor]];

[postTitle setShadowOffset:CGSizeMake(0, -1)];

Looks exactly like anything you'd put in a .title :)

Sahil
  • 1,268
  • 12
  • 19
5

shadow and shadowOffset are what you're looking for I think. Set those properties on the label and it should do what you want.

Genericrich
  • 4,611
  • 5
  • 36
  • 55
1

A white shadow and a plus one instead a minus one as offset gives that depressed embossed look.

boxed
  • 3,895
  • 2
  • 24
  • 26