【问题标题】:put two uiimageView at the background在后台放两个uiimageView
【发布时间】:2011-07-25 12:16:51
【问题描述】:

这是我的代码:

-(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 发送到背景,因此背景在蓝色和粉红色之间变化。请问我该怎么做?对不起我的英语我是法国人:/

【问题讨论】:

    标签: iphone xcode animation background uiimageview


    【解决方案1】:

    通过使用框架,您可以在背景中添加两个图像视图

    【讨论】:

    • image1.frame=cgrectmake(0,0,320,160); image2.frame=cgrectmake(0,160,320,160);
    • 不,你不明白“imgView2”占据了所有屏幕,我希望它淡入另一个图像,即“imgView”
    • 我正在尝试在背景中设置一个图像,然后将其更改为另一个图像
    【解决方案2】:

    可能有用

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

    通过改变背景图片名称可以实现。

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2014-02-05
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多