Round avatar icons.

// FREEBIE
This commit is contained in:
Matthew Chen 2017-04-06 21:54:43 -04:00
parent 7fb795491c
commit 27aeb425e4
1 changed files with 6 additions and 2 deletions

View File

@ -46,9 +46,13 @@ NS_ASSUME_NONNULL_BEGIN
- (void)configureProgrammatically
{
const CGFloat kAvatarSize = 40.f;
_avatarView = [UIImageView new];
_avatarView.contentMode = UIViewContentModeScaleToFill;
_avatarView.image = [UIImage imageNamed:@"empty-group-avatar"];
// applyRoundedBorderToImageView requires the avatar to have
// the correct size.
_avatarView.frame = CGRectMake(0, 0, kAvatarSize, kAvatarSize);
[self.contentView addSubview:_avatarView];
_nameLabel = [UILabel new];
@ -59,8 +63,8 @@ NS_ASSUME_NONNULL_BEGIN
[_avatarView autoVCenterInSuperview];
[_avatarView autoPinEdgeToSuperviewEdge:ALEdgeLeft withInset:8.f];
[_avatarView autoSetDimension:ALDimensionWidth toSize:40.f];
[_avatarView autoSetDimension:ALDimensionHeight toSize:40.f];
[_avatarView autoSetDimension:ALDimensionWidth toSize:kAvatarSize];
[_avatarView autoSetDimension:ALDimensionHeight toSize:kAvatarSize];
[_nameLabel autoPinEdgeToSuperviewEdge:ALEdgeRight];
[_nameLabel autoPinEdgeToSuperviewEdge:ALEdgeTop];