mirror of https://github.com/LIJI32/SameBoy.git
Refine the tip animation
This commit is contained in:
parent
34c29b052e
commit
e381ebd1ea
|
@ -120,7 +120,7 @@ static NSString *const tips[] = {
|
|||
effect = [UIBlurEffect effectWithStyle:UIBlurEffectStyleProminent];
|
||||
}
|
||||
|
||||
_effectView = [[UIVisualEffectView alloc] initWithEffect:effect];
|
||||
_effectView = [[UIVisualEffectView alloc] initWithEffect:nil];
|
||||
_effectView.layer.cornerRadius = 8;
|
||||
_effectView.layer.masksToBounds = true;
|
||||
[self.view.window addSubview:_effectView];
|
||||
|
@ -131,19 +131,17 @@ static NSString *const tips[] = {
|
|||
_tipLabel.textColor = [UIColor labelColor];
|
||||
}
|
||||
_tipLabel.font = [UIFont systemFontOfSize:14];
|
||||
_tipLabel.alpha = 0.8;
|
||||
_tipLabel.alpha = 0;
|
||||
[[NSUserDefaults standardUserDefaults] setInteger:tipIndex + 1 forKey:@"GBTipIndex"];
|
||||
_tipLabel.lineBreakMode = NSLineBreakByWordWrapping;
|
||||
_tipLabel.numberOfLines = 3;
|
||||
[_effectView.contentView addSubview:_tipLabel];
|
||||
[self layoutTip];
|
||||
_effectView.alpha = 1;
|
||||
|
||||
dispatch_after(dispatch_time(DISPATCH_TIME_NOW, (int64_t)(1 * NSEC_PER_SEC)), dispatch_get_main_queue(), ^{
|
||||
[UIView animateWithDuration:0.25 animations:^{
|
||||
_effectView.alpha = 1.0;
|
||||
}];
|
||||
});
|
||||
[UIView animateWithDuration:0.25 animations:^{
|
||||
_effectView.effect = effect;
|
||||
_tipLabel.alpha = 0.8;
|
||||
}];
|
||||
|
||||
}
|
||||
|
||||
|
@ -168,7 +166,8 @@ static NSString *const tips[] = {
|
|||
- (void)viewWillDisappear:(BOOL)animated
|
||||
{
|
||||
[UIView animateWithDuration:0.25 animations:^{
|
||||
_effectView.alpha = 0;
|
||||
_effectView.effect = nil;
|
||||
_tipLabel.alpha = 0;
|
||||
} completion:^(BOOL finished) {
|
||||
[_effectView removeFromSuperview];
|
||||
}];
|
||||
|
|
Loading…
Reference in New Issue