Skip to content

Instantly share code, notes, and snippets.

@jinqian
Last active December 16, 2015 14:49
Show Gist options
  • Save jinqian/5451738 to your computer and use it in GitHub Desktop.
Save jinqian/5451738 to your computer and use it in GitHub Desktop.
//discount BG
_discountBackgroundView = [[UIImageView alloc] initWithImage:[UIImage MSRetailScannerImageNamed:@"Bargain"]];
UIImage* mask = [UIImage MSRetailScannerImageNamed:@"Bargain-mask"];
if (mask)
{
_discountBackgroundView.layer.mask = [CALayer layer];
_discountBackgroundView.layer.mask.frame = _discountBackgroundView.layer.bounds;
_discountBackgroundView.layer.mask.contents = (__bridge id)[mask CGImage];
}
else
{
_discountBackgroundView.layer.mask = nil;
}
[self addSubview:_discountBackgroundView];
//discount label
_discountLabel = [[UILabel alloc] initWithFrame:CGRectZero];
_discountLabel.backgroundColor = [UIColor clearColor];
_discountLabel.textColor = [UIColor whiteColor];
_discountLabel.font = [UIFont fontWithName:@"DINPro-Regular" size:14];
_discountLabel.textAlignment = NSTextAlignmentCenter;
_discountLabel.adjustsFontSizeToFitWidth = YES;
[self.discountBackgroundView addSubview:_discountLabel];
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment