KWMLastView.m 2.42 KB
Newer Older
houweibin committed
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
//
//  KWMLastView.m
//  iCemarose
//
//  Created by 陈荣科 on 16/8/25.
//  Copyright © 2016年 kollway. All rights reserved.
//

#import "KWMLastView.h"

@implementation KWMLastView

- (void)awakeFromNib{
    self.btnEnter.layer.borderWidth = 1;
    self.btnEnter.layer.borderColor = [UIColor blackColor].CGColor;
}

- (void)layoutSubviews{
    
    CGFloat logoY = UI_SCREEN_HEITHT*0.2279f;
    CGFloat logoW = UI_SCREEN_WIDTH*0.4f;
    CGFloat logoH = UI_SCREEN_HEITHT*0.0404f;
    self.logoTop.constant = logoY;
    self.logoWidth.constant = logoW;
    self.logoHeight.constant = logoH;
    
    CGFloat enterY = UI_SCREEN_HEITHT*0.8065f;
    CGFloat enterW = UI_SCREEN_WIDTH*0.2453f;
    CGFloat enterH = UI_SCREEN_HEITHT*0.0420f;
    self.enterTop.constant = enterY;
    self.enterWidth.constant = enterW;
    self.enterHeight.constant = enterH;
    
}

- (void)animating{
37 38 39 40 41 42 43 44 45 46
//    CABasicAnimation *textAnimation = [self getShowAnimation];
//    [self.lbText.layer addAnimation:textAnimation forKey:@"textAnimation"];
    self.lbText.alpha = 0;
    self.btnEnter.alpha = 0;
    [UIView animateWithDuration:1.5 animations:^{
        self.lbText.alpha = 1;
    }];
    [UIView animateWithDuration:1.5 delay:0.8 options:0 animations:^{
        self.btnEnter.alpha = 1;
    } completion:nil];
houweibin committed
47 48 49 50
}

- (CABasicAnimation *)getShowAnimation{
    CABasicAnimation *enterAnimation = [CABasicAnimation animationWithKeyPath:@"opacity"];
51
    enterAnimation.duration = 1.5f;
houweibin committed
52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68
    enterAnimation.repeatCount = 1;
    enterAnimation.delegate = self;
    enterAnimation.fromValue = [NSNumber numberWithDouble:0.0f];
    enterAnimation.toValue = [NSNumber numberWithDouble:1.0f];
    enterAnimation.autoreverses = NO;
    enterAnimation.removedOnCompletion = NO;
    return enterAnimation;
}

- (void)animationDidStop:(CAAnimation *)anim finished:(BOOL)flag{
    if([self.btnEnter.layer animationForKey:@"enterAnimation" ] ==  anim){
        self.btnEnter.alpha = 1.0;
        [self.btnEnter.layer removeAllAnimations];
    }else{
        self.lbText.alpha = 1.0;
        [self.lbText.layer removeAllAnimations];
        CABasicAnimation *enterAnimation = [self getShowAnimation];
69
        enterAnimation.beginTime = 0;
houweibin committed
70 71 72 73 74 75 76 77 78 79 80 81 82
        [self.btnEnter.layer addAnimation:enterAnimation forKey:@"enterAnimation"];
    }
}

//点击进入按钮
- (IBAction)onClickEnterBtn:(id)sender {
    
    if (self.delegate != nil) {
        [self.delegate kwm_enter];
    }
    NSLog(@"点击了进入按钮");
}
@end