1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374 |
- //
- // FKSubmitDiscountView.m
- // FirstLink
- //
- // Created by ascii on 15/11/10.
- // Copyright © 2015年 FirstLink. All rights reserved.
- //
- #import "FKSubmitDiscountView.h"
- @interface FKSubmitDiscountView ()
- @property (nonatomic, strong) UIImageView *iconView;
- @end
- @implementation FKSubmitDiscountView
- /*
- // Only override drawRect: if you perform custom drawing.
- // An empty implementation adversely affects performance during animation.
- - (void)drawRect:(CGRect)rect {
- // Drawing code
- }
- */
- - (instancetype)initWithFrame:(CGRect)frame {
- self = [super initWithFrame:frame];
- if (self) {
- self.backgroundColor = UIColorFromRGB(0xdcbe9c);
-
- [self addAllSubviews];
- }
- return self;
- }
- #pragma mark - Layout
- - (void)addAllSubviews {
- [self addSubview:self.textLabel];
- [self.textLabel mas_makeConstraints:^(MASConstraintMaker *make) {
- make.centerY.equalTo(self);
- make.centerX.equalTo(self);
- }];
-
- [self addSubview:self.iconView];
- [self.iconView mas_makeConstraints:^(MASConstraintMaker *make) {
- make.right.equalTo(self.textLabel.mas_left).with.offset(-7);
- make.centerY.equalTo(self.textLabel);
- }];
- }
- #pragma mark - Property
- - (UILabel *)textLabel {
- if (!_textLabel) {
- _textLabel = [[UILabel alloc] init];
- _textLabel.textColor = UIColorFromRGB(0xffffff);
- _textLabel.backgroundColor = [UIColor clearColor];
- _textLabel.font = [UIFont systemFontOfSize:13];
- }
- return _textLabel;
- }
- - (UIImageView *)iconView {
- if (!_iconView) {
- _iconView = [[UIImageView alloc] init];
- _iconView.image = [UIImage imageNamed:@"ActivityDiscountIcon"];
- }
- return _iconView;
- }
- @end
|