iOS-應用管理 點擊按鈕下載動畫

來源:互聯網
上載者:User

標籤:

////  CZAppView.m//  應用管理////  Created by YaguangZhu on 15/8/1.//  Copyright (c) 2015年 YaguangZhu. All rights reserved.//#import "CZAppView.h"#import "app.h"@interface CZAppView ()@property (weak, nonatomic) IBOutlet UIImageView *imgViewIcon;@property (weak, nonatomic) IBOutlet UILabel *lblName;@property (weak, nonatomic) IBOutlet UIButton *btnDownload;- (IBAction)btnDownloadClick:(UIButton *)sender;@end@implementation CZAppView/*// Only override drawRect: if you perform custom drawing.// An empty implementation adversely affects performance during animation.- (void)drawRect:(CGRect)rect {    // Drawing code}*/+ (instancetype)appView{     NSBundle *rootBoundle = [NSBundle mainBundle];    return  [[rootBoundle loadNibNamed:@"CZAppView" owner:nil options:nil ] lastObject];}- (void)setModel:(app *)model{    _model = model;        self.imgViewIcon.image = [UIImage imageNamed:model.icon];    self.lblName.text = model.miaoshu;}- (IBAction)btnDownloadClick:(UIButton *)sender {    sender.enabled = NO;        UILabel *lbMsg = [[UILabel alloc]init];    lbMsg.text= @" downloading.......";    lbMsg.backgroundColor = [UIColor redColor];    CGFloat viewW = self.superview.frame.size.width;    CGFloat viewH = self.superview.frame.size.height;    CGFloat msgW = 200;    CGFloat msgH = 20;    CGFloat msgX =(viewW - msgW)/2;    CGFloat msgY = (viewH - msgH)*0.5;    lbMsg.frame = CGRectMake(msgX, msgY, msgW, msgH);    //顏色    lbMsg.textColor = [UIColor blackColor];    //置中    lbMsg.textAlignment = NSTextAlignmentCenter;    //粗體    lbMsg.font = [UIFont boldSystemFontOfSize:17];    //透明度    lbMsg.alpha = 0.0;    //設定圓角    lbMsg.layer.cornerRadius = 10;    lbMsg.layer.masksToBounds =YES;//    [UIView animateWithDuration:1.0 animations:^{//        lbMsg.alpha = 0.5;//    }];    //一個動畫結束後 開啟另外一個動畫 延遲1秒開始    [UIView animateWithDuration:1.5 animations:^{        lbMsg.alpha = 0.5;    } completion:^(BOOL finished) {        if (finished) {            [ UIView animateWithDuration:1.5 delay:1.0 options:UIViewAnimationOptionCurveLinear animations:^{                lbMsg.alpha = 0;            } completion:^(BOOL finished) {                if (finished) {                    [lbMsg removeFromSuperview];                }            }];        }    }];        [self.superview addSubview:lbMsg];    }@end

 

iOS-應用管理 點擊按鈕下載動畫

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.