国产探花免费观看_亚洲丰满少妇自慰呻吟_97日韩有码在线_资源在线日韩欧美_一区二区精品毛片,辰东完美世界有声小说,欢乐颂第一季,yy玄幻小说排行榜完本

首頁 > 學院 > 開發設計 > 正文

IOS自定義場景切換動畫。

2019-11-14 19:35:49
字體:
來源:轉載
供稿:網友

  IOS中我們可以通過Storyborad以及segue來實現我們自己的場景切換動畫,新建項目使用Single View application模板并取名為MyCustomSegue。

  使用storyboard托出另一UIViewController并分設置兩個控制器的視圖顏色,并設置跳轉頁面的segue為custom

    

  

  設置如圖

  

  新建文件MyCustomChangeSegue并重新perform方法

  

 1 @implementation MyCustomChangeSegue 2  3 -(void)perform 4 { 5     UIViewController *sourceViewController = self.sourceViewController; 6     UIViewController *destViewController = self.destinationViewController; 7      8     [UIView animateWithDuration:1 animations:^{ 9         CGPoint centerPoint = sourceViewController.view.center;10         sourceViewController.view.frame = CGRectMake(centerPoint.x,centerPoint.y , 0, 0);11         sourceViewController.view.alpha = 0;12     } completion:^(BOOL success){13         UIView *destView = destViewController.view;14         sourceViewController.view.hidden = YES;15         [[sourceViewController.view superview] addSubview:destView];16         CGRect destRect = destView.frame;17         CGPoint centerPoint = destView.center;18         destView.frame = CGRectMake(centerPoint.x,centerPoint.y , 0, 0);19         destView.alpha = 0;20         [UIView animateWithDuration:0.3 animations:^{21             destView.frame = destRect;22             destView.alpha = 1;23         } completion:^(BOOL success){24             destView.alpha = 1;25             destView.frame = destRect;26             sourceViewController.view.hidden = NO;27             [sourceViewController PResentViewController:destViewController animated:NO completion:nil];28         }];29     }];30 }31 32 @end

 

  運行程序點擊go按鈕,我們就會看到神奇的一幕了!

  

 
 

發表評論 共有條評論
用戶名: 密碼:
驗證碼: 匿名發表
主站蜘蛛池模板: 平顺县| 南平市| 金塔县| 张北县| 台湾省| 安新县| 公安县| 孝昌县| 邵武市| 库车县| 钦州市| 晋中市| 潜江市| 兴和县| 张掖市| 天峻县| 含山县| 常熟市| 惠来县| 万源市| 塘沽区| 景谷| 静乐县| 仪征市| 招远市| 吉安市| 贡觉县| 奉节县| 五指山市| 宁南县| 尖扎县| 通化县| 西乡县| 房山区| 紫云| 遵义市| 定边县| 南通市| 阿城市| 安仁县| 沁阳市|