将两个 uiimageView 放在背景上
这是我的代码:
-(void)transition{
CATransition *applicationLoadViewIn = [CATransition animation];
[applicationLoadViewIn setDuration:2];
[applicationLoadViewIn setType:kCATransitionFade];
[applicationLoadViewIn setTimingFunction:[CAMediaTimingFunction functionWithName:kCAMediaTimingFunctionEaseIn]];
[[self.view layer] addAnimation:applicationLoadViewIn forKey:kCATransitionFade];
imgView2 = [[UIImageView alloc] initWithImage:[UIImage imageNamed:@"bluefont.png"]];
if(self.view.layer.sublayers.count<=2)
{
[[[self view] layer] addSublayer:[imgView2 layer]];
}
else {
[[self.view.layer.sublayers lastObject] removeFromSuperlayer];
}
[imgView2 release];
}
- (void)viewDidLoad {
[super viewDidLoad];
imgView = [[UIImageView alloc] initWithImage:[UIImage imageNamed:@"pinkfont.png"]];
[[[self view] layer] addSublayer:[imgView layer]];
[imgView release];
[NSTimer scheduledTimerWithTimeInterval:5.0 target:self selector:@selector(transition) userInfo:nil repeats:YES];
}
我想将 imgView2 和 imgView 发送到背景,因此背景在蓝色和粉色之间变化。我该怎么做?抱歉我的英语我是法国人:/
here is my code:
-(void)transition{
CATransition *applicationLoadViewIn = [CATransition animation];
[applicationLoadViewIn setDuration:2];
[applicationLoadViewIn setType:kCATransitionFade];
[applicationLoadViewIn setTimingFunction:[CAMediaTimingFunction functionWithName:kCAMediaTimingFunctionEaseIn]];
[[self.view layer] addAnimation:applicationLoadViewIn forKey:kCATransitionFade];
imgView2 = [[UIImageView alloc] initWithImage:[UIImage imageNamed:@"bluefont.png"]];
if(self.view.layer.sublayers.count<=2)
{
[[[self view] layer] addSublayer:[imgView2 layer]];
}
else {
[[self.view.layer.sublayers lastObject] removeFromSuperlayer];
}
[imgView2 release];
}
- (void)viewDidLoad {
[super viewDidLoad];
imgView = [[UIImageView alloc] initWithImage:[UIImage imageNamed:@"pinkfont.png"]];
[[[self view] layer] addSublayer:[imgView layer]];
[imgView release];
[NSTimer scheduledTimerWithTimeInterval:5.0 target:self selector:@selector(transition) userInfo:nil repeats:YES];
}
I want to send imgView2 and imgView to the background, thus the background is changing between the blue and pink colour.How can I do this please ? sorry for my english I'm french :/
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
通过使用框架,您可以将两个图像视图添加到背景
by using the frames you can add two imageviews to the background
这可能很有用。
通过更改背景图像名称即可实现,
It may be useful
By changing the backgroundimage name you can achieve.