| 1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253 |
- //
- // MyTeamHeader.m
- // model
- //
- // Created by Drew on 2018/10/29.
- // Copyright © 2018 Mine. All rights reserved.
- //
- #import "MyTeamHeader.h"
- @interface MyTeamHeader()
- @property (weak, nonatomic) IBOutlet UIView *content;
- @property (weak, nonatomic) IBOutlet UILabel *inviteLabel;
- @property (weak, nonatomic) IBOutlet UILabel *rewardLabel;
- @end
- @implementation MyTeamHeader
- - (instancetype)initWithFrame:(CGRect)frame {
- if (self = [super initWithFrame:frame]) {
- [self initView];
- }
- return self;
- }
- - (instancetype)initWithCoder:(NSCoder *)aDecoder {
- if (self = [super initWithCoder:aDecoder]) {
- [self initView];
- }
- return self;
- }
- - (void) initView {
- NSBundle *bundle = [NSBundle bundleForClass:[self class]];
- NSString *className = NSStringFromClass([self class]);
- UIView *view = [[bundle loadNibNamed:className owner:self options:nil] firstObject];
- view.frame = self.bounds;
- [self addSubview:view];
- self.content.clipsToBounds = YES;
- }
- - (void)layoutSubviews {
- [super layoutSubviews];
- // gradient
- CAGradientLayer *gl = [CAGradientLayer layer];
- gl.frame = self.content.bounds;
- gl.startPoint = CGPointMake(0.03, 0.47);
- gl.endPoint = CGPointMake(0.97, 0.47);
- gl.colors = @[(__bridge id)[UIColor colorWithRed:251/255.0 green:92/255.0 blue:163/255.0 alpha:1].CGColor, (__bridge id)[UIColor colorWithRed:253/255.0 green:127/255.0 blue:141/255.0 alpha:1].CGColor];
- gl.locations = @[@(0), @(1.0f)];
- self.content.layer.cornerRadius = 12;
- [self.content.layer insertSublayer:gl atIndex:0];
- }
- @end
|