Ahh. Hope this will help someone else out who might run into this.
Though this code works against the cell just fine, that is because the cell
already has a border color defined as black. The imageView does not and
therefore requires a border color to be set like so:
[cell.imageView.layer setBorderColor: [[UIColor whiteColor] CGColor]];
[cell.imageView.layer setBorderColor: [[UIColor blackColor] CGColor]];
[cell.imageView.layer setBorderColor: [[UIColor colorWithRed:.5f green:.6f blue:.3f alpha:.75f] CGColor ]];
On Aug 16, 2013, at 09:13 AM, Alex Zavatone <z...@mac.com> wrote:
I've looked around StackExchange and though there are many suggestions on how
to add borders to UITableViewCells, which I've tested and which work, I'm at a
loss on how to add a border to a UITableViewCell's imageView.
Within tableView:cellForRowAtIndexPath, I've got this code:
UITableViewCell *cell = [tableView
dequeueReusableCellWithIdentifier:CellIdentifier];
cell.imageView.image = [UIImage imageNamed:@"Placeholder.png"];
CALayer* layer;
//layer = cell.layer;
layer = cell.imageView.layer;
[layer setMasksToBounds:YES];
[layer setCornerRadius:10.0f];
[layer setBorderWidth:10.0f];
Note the commented out //layer = cell.layer; line. If this is uncommented and
the line below it is commented, the cell gets a thick border around the cell
itself as expected, but when trying the same on the cell.imageView.layer there
is no change to the cell's imageView.
Is there something I'm missing here?
I'm on iOS 6.x, Xcode 4.6.3
Thanks
- Alex Zavatone
_______________________________________________
Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)
Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com
Help/Unsubscribe/Update your Subscription:
https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com
This email sent to arch...@mail-archive.com