Iphone 在背景中放置两个uiimageView

Iphone 在背景中放置两个uiimageView,iphone,xcode,animation,background,uiimageview,Iphone,Xcode,Animation,Background,Uiimageview,这是我的密码: -(void)transition{ CATransition *applicationLoadViewIn = [CATransition animation]; [applicationLoadViewIn setDuration:2]; [applicationLoadViewIn setType:kCATransitionFade]; [applicationLoadViewIn setTimingFunction:[CAMediaTimingFunction funct

这是我的密码:

-(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];
-(无效)转换{
CATTransition*applicationLoadViewIn=[CATTransition动画];
[applicationLoadViewIn-setDuration:2];
[applicationLoadViewIn设置类型:kCATransitionFade];
[applicationLoadViewIn setTimingFunction:[CAMediaTimingFunction,名称:KCAMediaTimingFunctionAsein];
[[self.view layer]addAnimation:applicationLoadViewIn-forKey:kCATransitionFade];
imgView2=[[UIImageView alloc]initWithImage:[UIImageName:@“bluefont.png”];

如果(self.view.layer.sublayers.count)使用帧,您可以将两个图像视图添加到背景中,这可能会很有用

self.view.backgroundColor = [[UIColor alloc] initWithPatternImage:[UIImage imageNamed:@"image.png"]];

通过更改背景图像名称,您可以实现。

image1.frame=cgrectmake(0,0320160);image2.frame=cgrectmake(0160320160);不,您不明白“imgView 2”占据了整个屏幕,我希望它淡入另一个图像,即“imgView”我试图在背景中设置一个图像,然后将其更改为另一个图像