程序師世界是廣大編程愛好者互助、分享、學習的平台,程序師世界有你更精彩!
首頁
編程語言
C語言|JAVA編程
Python編程
網頁編程
ASP編程|PHP編程
JSP編程
數據庫知識
MYSQL數據庫|SqlServer數據庫
Oracle數據庫|DB2數據庫
 程式師世界 >> 編程語言 >> 更多編程語言 >> 編程綜合問答 >> ios-iphone中使用彈出動畫

ios-iphone中使用彈出動畫

編輯:編程綜合問答
iphone中使用彈出動畫

使用了下面的代碼:

FirstView * fir=[[FirstView alloc]init];
[self.navigationController pushViewController:fir animated:NO];

能否實現一個彈出動畫?
謝謝

最佳回答:


-(void)ButtonAction:(id)sender{
  [self SwipeRight:self.navigationController.view];  // <--calling method
  //[self.navigationController pushViewController:viewcontrollerobject animated:NO];
  // or pop // 
}

    -(void)SwipeRight:(UIView *)view{

        CATransition* transition = [CATransition animation];
        [transition setDuration:0.3];
        transition.type = kCATransitionPush;
        transition.subtype = kCATransitionFromRight;
        [transition setFillMode:kCAFillModeBoth];
        [transition setTimingFunction:[CAMediaTimingFunction functionWithName:kCAMediaTimingFunctionEaseInEaseOut]];
        [view.layer addAnimation:transition forKey:kCATransition]; 
    }

    -(void)SwipeLeft:(UIView *)view{
        CATransition* transition = [CATransition animation];
        [transition setDuration:0.3];
        transition.type = kCATransitionPush;
        transition.subtype = kCATransitionFromLeft;
        [transition setFillMode:kCAFillModeBoth];
        [transition setTimingFunction:[CAMediaTimingFunction functionWithName:kCAMediaTimingFunctionEaseInEaseOut]];
        [view.layer addAnimation:transition forKey:kCATransition]; 
    }
  1. 上一頁:
  2. 下一頁:
Copyright © 程式師世界 All Rights Reserved