RankDetailView.m 23.1 KB
Newer Older
admin's avatar
admin committed
1
//
2
//  RankDetailView.m
admin's avatar
admin committed
3 4
//  redstar
//
5
//  Created by admin on 15/11/12.
admin's avatar
admin committed
6 7 8
//  Copyright © 2015年 ZWF. All rights reserved.
//

9
#import "RankDetailView.h"
10

11
@interface RankDetailView ()
12 13 14
@property (nonatomic, strong) UIView *lineView1;
@property (nonatomic, strong) UIView *lineView2;

15 16 17
@property (nonatomic, strong) UIView *uplineView;
@property (nonatomic, strong) UIView *downlineView;

18 19
@end

20
@implementation RankDetailView
admin's avatar
admin committed
21

22 23 24
- (instancetype)init
{
    self = [super init];
admin's avatar
admin committed
25 26 27 28 29 30
    if (self) {
        [self setup];
    }
    return self;
}

31 32 33 34 35 36 37 38
- (instancetype)initWithFrame:(CGRect)frame
{
    self = [super initWithFrame:frame];
    if (self) {
        [self setup];
    }
    return self;
}
admin's avatar
admin committed
39 40 41 42

#pragma mark - Private Methods
- (void)setup
{
43 44 45 46 47 48 49 50
    self.addressLabel.font = [UIFont systemFontOfSize:14.0];
    self.titleLabel.font = [UIFont systemFontOfSize:17.0];
    self.reportTimeLabel.font = [UIFont systemFontOfSize:14.0];
    self.lineView1.backgroundColor = kSeparateLineColor;
    self.totalScoreLabel.font =  [UIFont systemFontOfSize:14.0];
    self.lineView2.backgroundColor = kSeparateLineColor;
    self.totalGradeLabel.font = [UIFont systemFontOfSize:14.0];
    self.timeLabel.font = [UIFont systemFontOfSize:16.0];
51
    
52 53
    self.scoreLabel.font = [UIFont systemFontOfSize:17.0];
    self.gradeView.backgroundColor = [UIColor clearColor];
54 55 56 57
    
    self.uplineView.backgroundColor = kSeparateLineColor;
    self.downlineView.backgroundColor = kSeparateLineColor;

58 59 60 61 62 63 64 65 66
}

#pragma mark - Lazy Loading
- (UILabel *)addressLabel
{
    if (!_addressLabel) {
        _addressLabel = [[UILabel alloc] init];
        _addressLabel.translatesAutoresizingMaskIntoConstraints = NO;
        _addressLabel.textColor = kDetailSmallTitleColor;
67
        [self addSubview:_addressLabel];
68
        
69 70
        NSLayoutConstraint *addressTop = [NSLayoutConstraint constraintWithItem:_addressLabel attribute:NSLayoutAttributeTop relatedBy:NSLayoutRelationEqual toItem:self attribute:NSLayoutAttributeTop multiplier:1.0 constant:1];
        [self addConstraint:addressTop];
71
        
72 73
        NSLayoutConstraint *addressLeft = [NSLayoutConstraint constraintWithItem:_addressLabel attribute:NSLayoutAttributeLeft relatedBy:NSLayoutRelationEqual toItem:self attribute:NSLayoutAttributeLeft multiplier:1.0 constant:20];
        [self addConstraint:addressLeft];
74
        
75 76
        NSLayoutConstraint *addressRight = [NSLayoutConstraint constraintWithItem:_addressLabel attribute:NSLayoutAttributeRight relatedBy:NSLayoutRelationEqual toItem:self attribute:NSLayoutAttributeRight multiplier:1.0 constant:-20];
        [self addConstraint:addressRight];
77 78
        
        NSLayoutConstraint *addressHeight = [NSLayoutConstraint constraintWithItem:_addressLabel attribute:NSLayoutAttributeHeight relatedBy:NSLayoutRelationEqual toItem:nil attribute:NSLayoutAttributeNotAnAttribute multiplier:1.0 constant:40];
79
        [self addConstraint:addressHeight];
80 81 82 83 84 85 86 87
        
    }
    return _addressLabel;
}

- (UIScrollView *)showScrollView
{
    if (!_showScrollView) {
88 89 90
        _showScrollView = [[UIScrollView alloc] initWithFrame:CGRectMake(20, 41, kScreenWidth - 40, 70)];
        _showScrollView.showsHorizontalScrollIndicator = NO;
        _showScrollView.showsVerticalScrollIndicator = NO;
91
        [self addSubview:_showScrollView];
92
        
93 94 95 96 97 98 99 100 101 102 103
//        NSLayoutConstraint *showTop = [NSLayoutConstraint constraintWithItem:_showScrollView attribute:NSLayoutAttributeTop relatedBy:NSLayoutRelationEqual toItem:self.addressLabel attribute:NSLayoutAttributeBottom multiplier:1.0 constant:0];
//        [self addConstraint:showTop];
//        
//        NSLayoutConstraint *showLeft = [NSLayoutConstraint constraintWithItem:_showScrollView attribute:NSLayoutAttributeLeft relatedBy:NSLayoutRelationEqual toItem:self attribute:NSLayoutAttributeLeft multiplier:1.0 constant:20];
//        [self addConstraint:showLeft];
//        
//        NSLayoutConstraint *showRight = [NSLayoutConstraint constraintWithItem:_showScrollView attribute:NSLayoutAttributeRight relatedBy:NSLayoutRelationEqual toItem:self attribute:NSLayoutAttributeRight multiplier:1.0 constant:-20];
//        [self addConstraint:showRight];
//        
//        NSLayoutConstraint *showHeight = [NSLayoutConstraint constraintWithItem:_showScrollView attribute:NSLayoutAttributeHeight relatedBy:NSLayoutRelationEqual toItem:nil attribute:NSLayoutAttributeNotAnAttribute multiplier:1.0 constant:70];
//        [self addConstraint:showHeight];
104 105 106 107 108 109 110 111 112 113
    }
    return _showScrollView;
}

- (UILabel *)titleLabel
{
    if (!_titleLabel) {
        _titleLabel = [[UILabel alloc] init];
        _titleLabel.translatesAutoresizingMaskIntoConstraints = NO;
        _titleLabel.textColor = kDetailBigTitleColor;
114
        [self addSubview:_titleLabel];
115 116
        
        NSLayoutConstraint *titleTop = [NSLayoutConstraint constraintWithItem:_titleLabel attribute:NSLayoutAttributeTop relatedBy:NSLayoutRelationEqual toItem:self.showScrollView attribute:NSLayoutAttributeBottom multiplier:1.0 constant:7];
117
        [self addConstraint:titleTop];
118
        
119 120
        NSLayoutConstraint *titleLeft = [NSLayoutConstraint constraintWithItem:_titleLabel attribute:NSLayoutAttributeLeft relatedBy:NSLayoutRelationEqual toItem:self attribute:NSLayoutAttributeLeft multiplier:1.0 constant:20];
        [self addConstraint:titleLeft];
121
        
122 123
        NSLayoutConstraint *titleRight = [NSLayoutConstraint constraintWithItem:_titleLabel attribute:NSLayoutAttributeRight relatedBy:NSLayoutRelationEqual toItem:self attribute:NSLayoutAttributeRight multiplier:1.0 constant:-20];
        [self addConstraint:titleRight];
124 125
        
        NSLayoutConstraint *titleHeight = [NSLayoutConstraint constraintWithItem:_titleLabel attribute:NSLayoutAttributeHeight relatedBy:NSLayoutRelationEqual toItem:nil attribute:NSLayoutAttributeNotAnAttribute multiplier:1.0 constant:23];
126
        [self addConstraint:titleHeight];
127 128 129 130 131 132 133 134 135 136
    }
    return _titleLabel;
}

- (UILabel *)reportTimeLabel
{
    if (!_reportTimeLabel) {
        _reportTimeLabel = [[UILabel alloc] init];
        _reportTimeLabel.translatesAutoresizingMaskIntoConstraints = NO;
        _reportTimeLabel.textColor = kDetailSmallTitleColor;
137
        [self addSubview:_reportTimeLabel];
138 139
        
        NSLayoutConstraint *reportTop = [NSLayoutConstraint constraintWithItem:_reportTimeLabel attribute:NSLayoutAttributeTop relatedBy:NSLayoutRelationEqual toItem:self.titleLabel attribute:NSLayoutAttributeBottom multiplier:1.0 constant:10];
140
        [self addConstraint:reportTop];
141
        
142 143
        NSLayoutConstraint *reportLeft = [NSLayoutConstraint constraintWithItem:_reportTimeLabel attribute:NSLayoutAttributeLeft relatedBy:NSLayoutRelationEqual toItem:self attribute:NSLayoutAttributeLeft multiplier:1.0 constant:20];
        [self addConstraint:reportLeft];
144 145
        
        NSLayoutConstraint *reportRight = [NSLayoutConstraint constraintWithItem:_reportTimeLabel attribute:NSLayoutAttributeRight relatedBy:NSLayoutRelationEqual toItem:self.lineView1 attribute:NSLayoutAttributeLeft multiplier:1.0 constant:0];
146
        [self addConstraint:reportRight];
147 148
        
        NSLayoutConstraint *reportHeight = [NSLayoutConstraint constraintWithItem:_reportTimeLabel attribute:NSLayoutAttributeHeight relatedBy:NSLayoutRelationEqual toItem:nil attribute:NSLayoutAttributeNotAnAttribute multiplier:1.0 constant:20];
149
        [self addConstraint:reportHeight];
150 151
        
        NSLayoutConstraint *reportWidth = [NSLayoutConstraint constraintWithItem:_reportTimeLabel attribute:NSLayoutAttributeWidth relatedBy:NSLayoutRelationEqual toItem:self.totalScoreLabel attribute:NSLayoutAttributeWidth multiplier:1.0 constant:0];
152
        [self addConstraint:reportWidth];
153 154
    }
    return _reportTimeLabel;
admin's avatar
admin committed
155 156
}

157 158 159 160 161
- (UIView *)lineView1
{
    if (!_lineView1) {
        _lineView1 = [[UIView alloc] init];
        _lineView1.translatesAutoresizingMaskIntoConstraints = NO;
162
        [self addSubview:_lineView1];
163 164
        
        NSLayoutConstraint *lineView1Top = [NSLayoutConstraint constraintWithItem:_lineView1 attribute:NSLayoutAttributeTop relatedBy:NSLayoutRelationEqual toItem:self.titleLabel attribute:NSLayoutAttributeBottom multiplier:1.0 constant:12];
165
        [self addConstraint:lineView1Top];
166
        
167 168
        NSLayoutConstraint *lineView1Bottom = [NSLayoutConstraint constraintWithItem:_lineView1 attribute:NSLayoutAttributeBottom relatedBy:NSLayoutRelationEqual toItem:self attribute:NSLayoutAttributeBottom multiplier:1.0 constant:-12];
        [self addConstraint:lineView1Bottom];
169 170
        
        NSLayoutConstraint *lineView1Right = [NSLayoutConstraint constraintWithItem:_lineView1 attribute:NSLayoutAttributeRight relatedBy:NSLayoutRelationEqual toItem:self.totalScoreLabel attribute:NSLayoutAttributeLeft multiplier:1.0 constant:0];
171
        [self addConstraint:lineView1Right];
172 173
        
        NSLayoutConstraint *lineView1Width = [NSLayoutConstraint constraintWithItem:_lineView1 attribute:NSLayoutAttributeWidth relatedBy:NSLayoutRelationEqual toItem:nil attribute:NSLayoutAttributeNotAnAttribute multiplier:1.0 constant:1];
174
        [self addConstraint:lineView1Width];
175 176 177 178
    }
    return _lineView1;
}

179
- (UILabel *)totalScoreLabel
180 181 182 183 184 185
{
    if (!_totalScoreLabel) {
        _totalScoreLabel = [[UILabel alloc] init];
        _totalScoreLabel.textAlignment = NSTextAlignmentCenter;
        _totalScoreLabel.translatesAutoresizingMaskIntoConstraints = NO;
        _totalScoreLabel.textColor = kDetailSmallTitleColor;
186
        [self addSubview:_totalScoreLabel];
187 188
        
        NSLayoutConstraint *reportTop = [NSLayoutConstraint constraintWithItem:_totalScoreLabel attribute:NSLayoutAttributeTop relatedBy:NSLayoutRelationEqual toItem:self.titleLabel attribute:NSLayoutAttributeBottom multiplier:1.0 constant:10];
189
        [self addConstraint:reportTop];
190 191
        
        NSLayoutConstraint *reportRight = [NSLayoutConstraint constraintWithItem:_totalScoreLabel attribute:NSLayoutAttributeRight relatedBy:NSLayoutRelationEqual toItem:self.lineView2 attribute:NSLayoutAttributeLeft multiplier:1.0 constant:0];
192
        [self addConstraint:reportRight];
193 194
        
        NSLayoutConstraint *reportHeight = [NSLayoutConstraint constraintWithItem:_totalScoreLabel attribute:NSLayoutAttributeHeight relatedBy:NSLayoutRelationEqual toItem:nil attribute:NSLayoutAttributeNotAnAttribute multiplier:1.0 constant:20];
195
        [self addConstraint:reportHeight];
196 197
        
        NSLayoutConstraint *reportWidth = [NSLayoutConstraint constraintWithItem:_totalScoreLabel attribute:NSLayoutAttributeWidth relatedBy:NSLayoutRelationEqual toItem:self.totalGradeLabel attribute:NSLayoutAttributeWidth multiplier:1.0 constant:0];
198
        [self addConstraint:reportWidth];
199 200 201 202 203 204 205 206 207
    }
    return _totalScoreLabel;
}

- (UIView *)lineView2
{
    if (!_lineView2) {
        _lineView2 = [[UIView alloc] init];
        _lineView2.translatesAutoresizingMaskIntoConstraints = NO;
208
        [self addSubview:_lineView2];
209 210
        
        NSLayoutConstraint *lineView2Top = [NSLayoutConstraint constraintWithItem:_lineView2 attribute:NSLayoutAttributeTop relatedBy:NSLayoutRelationEqual toItem:self.titleLabel attribute:NSLayoutAttributeBottom multiplier:1.0 constant:12];
211
        [self addConstraint:lineView2Top];
212
        
213 214
        NSLayoutConstraint *lineView2Bottom = [NSLayoutConstraint constraintWithItem:_lineView2 attribute:NSLayoutAttributeBottom relatedBy:NSLayoutRelationEqual toItem:self attribute:NSLayoutAttributeBottom multiplier:1.0 constant:-12];
        [self addConstraint:lineView2Bottom];
215 216
        
        NSLayoutConstraint *lineView2Right = [NSLayoutConstraint constraintWithItem:_lineView2 attribute:NSLayoutAttributeRight relatedBy:NSLayoutRelationEqual toItem:self.totalGradeLabel attribute:NSLayoutAttributeLeft multiplier:1.0 constant:0];
217
        [self addConstraint:lineView2Right];
218 219
        
        NSLayoutConstraint *lineView2Width = [NSLayoutConstraint constraintWithItem:_lineView2 attribute:NSLayoutAttributeWidth relatedBy:NSLayoutRelationEqual toItem:nil attribute:NSLayoutAttributeNotAnAttribute multiplier:1.0 constant:1];
220
        [self addConstraint:lineView2Width];
221 222 223 224 225 226 227 228 229 230 231
    }
    return _lineView2;
}

- (UILabel *)totalGradeLabel
{
    if (!_totalGradeLabel) {
        _totalGradeLabel = [[UILabel alloc] init];
        _totalGradeLabel.textAlignment = NSTextAlignmentCenter;
        _totalGradeLabel.translatesAutoresizingMaskIntoConstraints = NO;
        _totalGradeLabel.textColor = kDetailSmallTitleColor;
232
        [self addSubview:_totalGradeLabel];
233 234
        
        NSLayoutConstraint *totalGradeTop = [NSLayoutConstraint constraintWithItem:_totalGradeLabel attribute:NSLayoutAttributeTop relatedBy:NSLayoutRelationEqual toItem:self.titleLabel attribute:NSLayoutAttributeBottom multiplier:1.0 constant:10];
235
        [self addConstraint:totalGradeTop];
236
        
237 238
        NSLayoutConstraint *totalGradeRight = [NSLayoutConstraint constraintWithItem:_totalGradeLabel attribute:NSLayoutAttributeRight relatedBy:NSLayoutRelationEqual toItem:self attribute:NSLayoutAttributeRight multiplier:1.0 constant:0];
        [self addConstraint:totalGradeRight];
239 240
        
        NSLayoutConstraint *totalGradeHeight = [NSLayoutConstraint constraintWithItem:_totalGradeLabel attribute:NSLayoutAttributeHeight relatedBy:NSLayoutRelationEqual toItem:nil attribute:NSLayoutAttributeNotAnAttribute multiplier:1.0 constant:20];
241
        [self addConstraint:totalGradeHeight];
242 243 244 245 246 247 248 249 250 251
    }
    return _totalGradeLabel;
}

- (UILabel *)timeLabel
{
    if (!_timeLabel) {
        _timeLabel = [[UILabel alloc] init];
        _timeLabel.textColor = kDetailBigTitleColor;
        _timeLabel.translatesAutoresizingMaskIntoConstraints = NO;
252
        [self addSubview:_timeLabel];
253 254
        
        NSLayoutConstraint *timeTop = [NSLayoutConstraint constraintWithItem:_timeLabel attribute:NSLayoutAttributeTop relatedBy:NSLayoutRelationEqual toItem:_reportTimeLabel attribute:NSLayoutAttributeBottom multiplier:1.0 constant:0];
255
        [self addConstraint:timeTop];
256
        
257 258
        NSLayoutConstraint *timeLeft = [NSLayoutConstraint constraintWithItem:_timeLabel attribute:NSLayoutAttributeLeft relatedBy:NSLayoutRelationEqual toItem:self attribute:NSLayoutAttributeLeft multiplier:1.0 constant:20];
        [self addConstraint:timeLeft];
259 260
        
        NSLayoutConstraint *timeRight = [NSLayoutConstraint constraintWithItem:_timeLabel attribute:NSLayoutAttributeRight relatedBy:NSLayoutRelationEqual toItem:self.lineView1 attribute:NSLayoutAttributeLeft multiplier:1.0 constant:0];
261
        [self addConstraint:timeRight];
262 263
        
        NSLayoutConstraint *timeHeight = [NSLayoutConstraint constraintWithItem:_timeLabel attribute:NSLayoutAttributeHeight relatedBy:NSLayoutRelationEqual toItem:nil attribute:NSLayoutAttributeNotAnAttribute multiplier:1.0 constant:30];
264
        [self addConstraint:timeHeight];
265 266 267 268 269 270 271 272 273 274 275
    }
    return _timeLabel;
}

- (UILabel *)scoreLabel
{
    if (!_scoreLabel) {
        _scoreLabel = [[UILabel alloc] init];
        _scoreLabel.translatesAutoresizingMaskIntoConstraints = NO;
        _scoreLabel.textColor = kNavigationBarColor;
        _scoreLabel.textAlignment = NSTextAlignmentCenter;
276
        [self addSubview:_scoreLabel];
277 278
        
        NSLayoutConstraint *scoreTop = [NSLayoutConstraint constraintWithItem:_scoreLabel attribute:NSLayoutAttributeTop relatedBy:NSLayoutRelationEqual toItem:_totalScoreLabel attribute:NSLayoutAttributeBottom multiplier:1.0 constant:0];
279
        [self addConstraint:scoreTop];
280 281
        
        NSLayoutConstraint *scoreRight = [NSLayoutConstraint constraintWithItem:_scoreLabel attribute:NSLayoutAttributeRight relatedBy:NSLayoutRelationEqual toItem:self.lineView2 attribute:NSLayoutAttributeLeft multiplier:1.0 constant:0];
282
        [self addConstraint:scoreRight];
283 284
        
        NSLayoutConstraint *scoreHeight = [NSLayoutConstraint constraintWithItem:_scoreLabel attribute:NSLayoutAttributeHeight relatedBy:NSLayoutRelationEqual toItem:nil attribute:NSLayoutAttributeNotAnAttribute multiplier:1.0 constant:30];
285
        [self addConstraint:scoreHeight];
286 287
        
        NSLayoutConstraint *scoreWidth = [NSLayoutConstraint constraintWithItem:_scoreLabel attribute:NSLayoutAttributeWidth relatedBy:NSLayoutRelationEqual toItem:_totalScoreLabel attribute:NSLayoutAttributeWidth multiplier:1.0 constant:0];
288
        [self addConstraint:scoreWidth];
289 290 291 292 293 294 295 296 297 298
        
    }
    return _scoreLabel;
}

- (UIView *)gradeView
{
    if (!_gradeView) {
        _gradeView = [[UIView alloc] init];
        _gradeView.translatesAutoresizingMaskIntoConstraints = NO;
299
        [self addSubview:_gradeView];
300 301
        
        NSLayoutConstraint *totalGradeTop = [NSLayoutConstraint constraintWithItem:_gradeView attribute:NSLayoutAttributeTop relatedBy:NSLayoutRelationEqual toItem:self.totalGradeLabel attribute:NSLayoutAttributeBottom multiplier:1.0 constant:0];
302
        [self addConstraint:totalGradeTop];
303 304
        
        NSLayoutConstraint *totalGradeLeft = [NSLayoutConstraint constraintWithItem:_gradeView attribute:NSLayoutAttributeLeft relatedBy:NSLayoutRelationEqual toItem:_lineView2 attribute:NSLayoutAttributeRight multiplier:1.0 constant:0];
305 306
        [self addConstraint:totalGradeLeft];
        
307
        
308 309
        NSLayoutConstraint *totalGradeRight = [NSLayoutConstraint constraintWithItem:_gradeView attribute:NSLayoutAttributeRight relatedBy:NSLayoutRelationEqual toItem:self attribute:NSLayoutAttributeRight multiplier:1.0 constant:0];
        [self addConstraint:totalGradeRight];
310
        
311 312
        NSLayoutConstraint *totalGradeBottom = [NSLayoutConstraint constraintWithItem:_gradeView attribute:NSLayoutAttributeBottom relatedBy:NSLayoutRelationEqual toItem:self attribute:NSLayoutAttributeBottom multiplier:1.0 constant:0];
        [self addConstraint:totalGradeBottom];
313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363
    }
    return _gradeView;
}

- (UILabel *)gradeLabel
{
    if (!_gradeLabel) {
        _gradeLabel = [[UILabel alloc] init];
        _gradeLabel.translatesAutoresizingMaskIntoConstraints = NO;
        _gradeLabel.textAlignment = NSTextAlignmentCenter;
        [self.gradeView addSubview:_gradeLabel];
        
        //
        NSLayoutConstraint *gradeTop = [NSLayoutConstraint constraintWithItem:_gradeLabel attribute:NSLayoutAttributeTop relatedBy:NSLayoutRelationEqual toItem:self.gradeView attribute:NSLayoutAttributeTop multiplier:1.0 constant:0];
        [self.gradeView addConstraint:gradeTop];
        
        NSLayoutConstraint *gradeRight = [NSLayoutConstraint constraintWithItem:_gradeLabel attribute:NSLayoutAttributeRight relatedBy:NSLayoutRelationEqual toItem:self.gradeView attribute:NSLayoutAttributeRight multiplier:1.0 constant:0];
        [self.gradeView addConstraint:gradeRight];
        
        NSLayoutConstraint *gradeHeight = [NSLayoutConstraint constraintWithItem:_gradeLabel attribute:NSLayoutAttributeHeight relatedBy:NSLayoutRelationEqual toItem:nil attribute:NSLayoutAttributeNotAnAttribute multiplier:1.0 constant:30];
        [self.gradeView addConstraint:gradeHeight];
        
        NSLayoutConstraint *gradeLeft = [NSLayoutConstraint constraintWithItem:_gradeLabel attribute:NSLayoutAttributeLeft relatedBy:NSLayoutRelationEqual toItem:self.gradeView attribute:NSLayoutAttributeLeft multiplier:1.0 constant:0];
        [self.gradeView addConstraint:gradeLeft];
    }
    return _gradeLabel;
}

- (UIImageView *)gradeImageView
{
    if (!_gradeImageView) {
        _gradeImageView = [[UIImageView alloc] init];
        _gradeImageView.translatesAutoresizingMaskIntoConstraints = NO;
        [self.gradeView addSubview:_gradeImageView];
        
        //
        NSLayoutConstraint *gradeCenterX = [NSLayoutConstraint constraintWithItem:_gradeImageView attribute:NSLayoutAttributeCenterX relatedBy:NSLayoutRelationEqual toItem:self.gradeView attribute:NSLayoutAttributeCenterX multiplier:1.0 constant:0];
        [self.gradeView addConstraint:gradeCenterX];
        
        NSLayoutConstraint *gradeCenterY = [NSLayoutConstraint constraintWithItem:_gradeImageView attribute:NSLayoutAttributeCenterY relatedBy:NSLayoutRelationEqual toItem:self.gradeView attribute:NSLayoutAttributeCenterY multiplier:1.0 constant:0];
        [self.gradeView addConstraint:gradeCenterY];
        
        NSLayoutConstraint *gradeWidth = [NSLayoutConstraint constraintWithItem:_gradeImageView attribute:NSLayoutAttributeWidth relatedBy:NSLayoutRelationEqual toItem:nil attribute:NSLayoutAttributeNotAnAttribute multiplier:1.0 constant:35];
        [self.gradeView addConstraint:gradeWidth];
        
        NSLayoutConstraint *gradeHeight = [NSLayoutConstraint constraintWithItem:_gradeImageView attribute:NSLayoutAttributeHeight relatedBy:NSLayoutRelationEqual toItem:nil attribute:NSLayoutAttributeNotAnAttribute multiplier:1.0 constant:34];
        [self.gradeView addConstraint:gradeHeight];
    }
    return _gradeImageView;
}

364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384
- (UIView *)uplineView
{
    if (!_uplineView) {
        _uplineView = [[UIView alloc] init];
        _uplineView.translatesAutoresizingMaskIntoConstraints = NO;
        [self addSubview:_uplineView];
        
        NSLayoutConstraint *lineView1Top = [NSLayoutConstraint constraintWithItem:_uplineView attribute:NSLayoutAttributeTop relatedBy:NSLayoutRelationEqual toItem:self attribute:NSLayoutAttributeTop multiplier:1.0 constant:0];
        [self addConstraint:lineView1Top];
        
        NSLayoutConstraint *lineView1Height = [NSLayoutConstraint constraintWithItem:_uplineView attribute:NSLayoutAttributeHeight relatedBy:NSLayoutRelationEqual toItem:nil attribute:NSLayoutAttributeNotAnAttribute multiplier:1.0 constant:1];
        [self addConstraint:lineView1Height];
        
        NSLayoutConstraint *lineView1Right = [NSLayoutConstraint constraintWithItem:_uplineView attribute:NSLayoutAttributeRight relatedBy:NSLayoutRelationEqual toItem:self attribute:NSLayoutAttributeRight multiplier:1.0 constant:0];
        [self addConstraint:lineView1Right];
        
        NSLayoutConstraint *lineView1Left = [NSLayoutConstraint constraintWithItem:_uplineView attribute:NSLayoutAttributeLeft relatedBy:NSLayoutRelationEqual toItem:self attribute:NSLayoutAttributeLeft multiplier:1.0 constant:0];
        [self addConstraint:lineView1Left];;
    }
    return _uplineView;
}
385

386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405
- (UIView *)downlineView
{
    if (!_downlineView) {
        _downlineView = [[UIView alloc] init];
        _downlineView.translatesAutoresizingMaskIntoConstraints = NO;
        [self addSubview:_downlineView];
        
        NSLayoutConstraint *lineView1Bottom = [NSLayoutConstraint constraintWithItem:_downlineView attribute:NSLayoutAttributeBottom relatedBy:NSLayoutRelationEqual toItem:self attribute:NSLayoutAttributeBottom multiplier:1.0 constant:0];
        [self addConstraint:lineView1Bottom];
        
        NSLayoutConstraint *lineView1Height = [NSLayoutConstraint constraintWithItem:_downlineView attribute:NSLayoutAttributeHeight relatedBy:NSLayoutRelationEqual toItem:nil attribute:NSLayoutAttributeNotAnAttribute multiplier:1.0 constant:1];
        [self addConstraint:lineView1Height];
        
        NSLayoutConstraint *lineView1Right = [NSLayoutConstraint constraintWithItem:_downlineView attribute:NSLayoutAttributeRight relatedBy:NSLayoutRelationEqual toItem:self attribute:NSLayoutAttributeRight multiplier:1.0 constant:0];
        [self addConstraint:lineView1Right];
        
        NSLayoutConstraint *lineView1Left = [NSLayoutConstraint constraintWithItem:_downlineView attribute:NSLayoutAttributeLeft relatedBy:NSLayoutRelationEqual toItem:self attribute:NSLayoutAttributeLeft multiplier:1.0 constant:0];
        [self addConstraint:lineView1Left];;
    }
    return _downlineView;
admin's avatar
admin committed
406 407
}

408

admin's avatar
admin committed
409
@end