Last active
December 16, 2015 14:49
-
-
Save jinqian/5451738 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//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