UIView動畫

    //視圖動畫

    //在系統註冊一個動畫,告訴系統爲當前的動畫作準備

    //*******************************開始動畫*****************************

    //參數1:動畫的名稱作爲一個id標誌

    //參數2:傳遞參數

    [UIView beginAnimations:nil context:nil];


    //設置動畫執行時間

    [UIView setAnimationDuration:3];

    //調用方法前必須先設置代理對象

    [UIView setAnimationDelegate:self];

    //設置在動畫執行前調用的方法

    [UIView setAnimationWillStartSelector:@selector(animationWillStart)];

    [UIView setAnimationDidStopSelector:@selector(animationDidStop)];

    //設置動畫運動曲線

    [UIView setAnimationCurve:UIViewAnimationCurveEaseInOut];

    //動畫重複次數

    [UIView setAnimationRepeatCount:10];

    //自動執行反向動畫

    [UIView setAnimationRepeatAutoreverses:YES];

    //動畫要執行的內容寫在begin和commit之間

    redView.frame = self.window.bounds;

    redView.backgroundColor = [UIColor blueColor];

    redView.alpha = 0.5;

    //*****************************提交動畫,動畫才真正開始****************************

    [UIView commitAnimations];


發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章