exchangeSubviewAtIndex:1 withSubviewAtIndex:2];
timer = [NSTimer scheduledTimerWithTimeInterval:11.0 target:self selector:@selector(changeView2) userInfo:nil repeats:NO];
}
-(void)changeView2
{
imageView3.frame = CGRectMake(0, 0, 520, 660);
[self change1];
CATransition * transition = [CATransition animation];
transition.duration = 2.0;//间隔时间
transition.timingFunction = UIViewAnimationCurveEaseInOut;//减缓动画
transition.type = kCATransitionFade;//各种效果
transition.subtype = kCATransitionFromRight;
transition.delegate = self;//代理,自带方法,动画的代理都不用协议
[self.view.layer addAnimation:transition forKey:nil];
[self.view exchangeSubviewAtIndex:2 withSubviewAtIndex:0];
timer = [NSTimer scheduledTimerWithTimeInterval:11.0 target:self selector:@selector(changeView) userInfo:nil repeats:NO];
}
|