// // 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{ // 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]; } - (CABasicAnimation *)getShowAnimation{ CABasicAnimation *enterAnimation = [CABasicAnimation animationWithKeyPath:@"opacity"]; enterAnimation.duration = 1.5f; 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]; enterAnimation.beginTime = 0; [self.btnEnter.layer addAnimation:enterAnimation forKey:@"enterAnimation"]; } } //点击进入按钮 - (IBAction)onClickEnterBtn:(id)sender { if (self.delegate != nil) { [self.delegate kwm_enter]; } NSLog(@"点击了进入按钮"); } @end