ViewControl 中添加 ViewControl
今天正好遇到一個(gè)小困惑就是如果在ViewControl 中添加 ViewControl,經(jīng)過查找得知原來就是直接 addSubview 其ViewControl.view 即可
下面是相關(guān)的代碼,可以在oneVC中先設(shè)置個(gè)顏色可方便看出其效果
OneViewController *oneVC = [OneViewController new];
UIView *myView= oneVC.view;
CABasicAnimation *animation = [CABasicAnimation animationWithKeyPath:@"position"];
// 動(dòng)畫選項(xiàng)的設(shè)定
animation.duration = 3; // 持續(xù)時(shí)間
animation.repeatCount = 1; // 重復(fù)次數(shù)
// 起始幀和終了幀的設(shè)定
animation.fromValue = [NSValue valueWithCGPoint:myView.layer.position]; // 起始幀
animation.toValue = [NSValue valueWithCGPoint:CGPointMake(0, 0)]; // 終了幀
// 添加動(dòng)畫
[myView.layer addAnimation:animation forKey:@"remove"];
[self.view addSubview:oneVC.view];