1

I'm trying to replicate how the Contacts app shows user pictures in my own app, but am at a loss as to how they went about it.

Here's how there's looks...

Contacts app image

...and (I assume) they are using a combination of these images (from the AddressBookUI framework) to accomplish it...

enter image description here enter image description here enter image description here

...but I'm not sure how. Most methods I've tried require an image without an alpha channel, yet their image marked "mask" (middle one) has an alpha channel. I've also tried other masking methods that just mask out a color but that doesn't seem to be the route they take.

Any insight into this?

rob5408
  • 2,972
  • 2
  • 40
  • 53

1 Answers1

2

I don't think they are combining any images. They are probably doing something like this:

imageView.layer.cornerRadius = 5;
imageView.layer.borderColor = [UIColor lightGrayColor].CGColor;
imageView.layer.borderWidth = 3;
imageView.layer.masksToBounds = YES;

And then you can just set the the image of the imageView normally (imageView.image = [UIImage imageName:@"person.png"];)

Michael Frederick
  • 16,664
  • 3
  • 43
  • 58
  • Totally didn't think of that, nice one, let me give that a shot. – rob5408 Sep 14 '11 at 23:49
  • Man, don't even want to tell you how long I tried to get the mask working. For completeness I'll just add that I needed to add #import for the layer bits and that it looks like the cornerRadius was 4 and cornerWidth was 1. Thanks! – rob5408 Sep 15 '11 at 03:27