Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Latest commit

 

History

History
History
104 lines (90 loc) · 4 KB

File metadata and controls

104 lines (90 loc) · 4 KB
Copy raw file
Download raw file
Open symbols panel
Edit and raw actions
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
//
// EaseStartView.m
// Coding_iOS
//
// Created by Ease on 14/12/26.
// Copyright (c) 2014年 Coding. All rights reserved.
//
#import "EaseStartView.h"
#import <NYXImagesKit/NYXImagesKit.h>
#import "StartImagesManager.h"
@interface EaseStartView ()
@property (strong, nonatomic) UIImageView *bgImageView, *logoIconView;
@property (strong, nonatomic) UILabel *descriptionStrLabel;
@end
@implementation EaseStartView
+ (instancetype)startView{
UIImage *logoIcon = [UIImage imageNamed:@"logo_coding_top"];
StartImage *st = [[StartImagesManager shareManager] randomImage];
return [[self alloc] initWithBgImage:st.image logoIcon:logoIcon descriptionStr:st.descriptionStr];
}
- (instancetype)initWithBgImage:(UIImage *)bgImage logoIcon:(UIImage *)logoIcon descriptionStr:(NSString *)descriptionStr{
self = [super initWithFrame:kScreen_Bounds];
if (self) {
//add custom code
UIColor *blackColor = [UIColor blackColor];
self.backgroundColor = blackColor;
_bgImageView = [[UIImageView alloc] initWithFrame:kScreen_Bounds];
_bgImageView.contentMode = UIViewContentModeScaleAspectFill;
_bgImageView.alpha = 0.0;
[self addSubview:_bgImageView];
if (![NSDate isDuringMidAutumn]) {
[self addGradientLayerWithColors:@[(id)[blackColor colorWithAlphaComponent:0.4].CGColor, (id)[blackColor colorWithAlphaComponent:0.0].CGColor] locations:nil startPoint:CGPointMake(0.5, 0.0) endPoint:CGPointMake(0.5, 0.4)];
}
_logoIconView = [[UIImageView alloc] init];
_logoIconView.contentMode = UIViewContentModeScaleAspectFit;
[self addSubview:_logoIconView];
_descriptionStrLabel = [[UILabel alloc] init];
_descriptionStrLabel.font = [UIFont systemFontOfSize:10];
_descriptionStrLabel.textColor = [UIColor colorWithWhite:1.0 alpha:0.5];
_descriptionStrLabel.textAlignment = NSTextAlignmentCenter;
_descriptionStrLabel.alpha = 0.0;
[self addSubview:_descriptionStrLabel];
[_descriptionStrLabel mas_makeConstraints:^(MASConstraintMaker *make) {
make.centerX.equalTo(@[self, _logoIconView]);
make.height.mas_equalTo(10);
make.bottom.equalTo(self.mas_bottom).offset(-15);
make.left.equalTo(self.mas_left).offset(20);
make.right.equalTo(self.mas_right).offset(-20);
}];
[_logoIconView mas_makeConstraints:^(MASConstraintMaker *make) {
make.centerX.equalTo(self);
make.top.mas_equalTo(kScreen_Height/7);
make.width.mas_equalTo(kScreen_Width *2/3);
make.height.mas_equalTo(kScreen_Width/4 *2/3);
}];
[self configWithBgImage:bgImage logoIcon:logoIcon descriptionStr:descriptionStr];
}
return self;
}
- (void)configWithBgImage:(UIImage *)bgImage logoIcon:(UIImage *)logoIcon descriptionStr:(NSString *)descriptionStr{
bgImage = [bgImage scaleToSize:[_bgImageView doubleSizeOfFrame] usingMode:NYXResizeModeAspectFill];
self.bgImageView.image = bgImage;
self.logoIconView.image = logoIcon;
self.descriptionStrLabel.text = descriptionStr;
[self updateConstraintsIfNeeded];
}
- (void)startAnimationWithCompletionBlock:(void(^)(EaseStartView *easeStartView))completionHandler{
[kKeyWindow addSubview:self];
[kKeyWindow bringSubviewToFront:self];
_bgImageView.alpha = 0.0;
_descriptionStrLabel.alpha = 0.0;
@weakify(self);
[UIView animateWithDuration:2.0 animations:^{
@strongify(self);
self.bgImageView.alpha = 1.0;
self.descriptionStrLabel.alpha = 1.0;
} completion:^(BOOL finished) {
[UIView animateWithDuration:0.6 delay:0.3 options:UIViewAnimationOptionCurveEaseIn animations:^{
@strongify(self);
[self setX:-kScreen_Width];
} completion:^(BOOL finished) {
@strongify(self);
[self removeFromSuperview];
if (completionHandler) {
completionHandler(self);
}
}];
}];
}
@end
Morty Proxy This is a proxified and sanitized view of the page, visit original site.