Contact image composition like Contacts app
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 abou开发者_如何学Ct it.
Here's how there's looks...
...and (I assume) they are using a combination of these images (from the AddressBookUI framework) to accomplish it...
...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?
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"];
)
精彩评论