开发者

gif image as a background

开发者 https://www.devze.com 2023-01-06 00:24 出处:网络
can we use a gif image as a background? i want to set an gif image as a background, like开发者_JAVA百科 some birds flying ....

can we use a gif image as a background? i want to set an gif image as a background, like开发者_JAVA百科 some birds flying ....

can we use gif image to set as background.???

if yes than how?

thanks and regards


Yes you can - I assume you want an animated gif?

It's the same CSS rule as a static background.

body {
    background: url(animated.gif);
}


Here, i got the solution.

UIImageView* animatedImageView = [[UIImageView alloc] initWithFrame:self.view.bounds];
    animatedImageView.animationImages = [NSArray arrayWithObjects:    
                                         [UIImage imageNamed:@"default1.jpg"],
                                         [UIImage imageNamed:@"default2.jpg"],
                                         [UIImage imageNamed:@"default3.jpg"],
                                         [UIImage imageNamed:@"default4.jpg"],
                                         [UIImage imageNamed:@"default5.jpg"],
                                         [UIImage imageNamed:@"default6.jpg"],
                                         [UIImage imageNamed:@"default7.jpg"],
                                         [UIImage imageNamed:@"default8.jpg"],
                                         [UIImage imageNamed:@"default9.jpg"],
                                         [UIImage imageNamed:@"default10.jpg"],                                      
                                         [UIImage imageNamed:@"default11.jpg"],
                                         [UIImage imageNamed:@"default12.jpg"],
                                         [UIImage imageNamed:@"default13.jpg"],
                                         [UIImage imageNamed:@"default14.jpg"],                                      
                                         [UIImage imageNamed:@"default15.jpg"], nil];
    animatedImageView.animationDuration = 3.0f;
    animatedImageView.animationRepeatCount = 0;
    [animatedImageView startAnimating];
    [self.view addSubview: animatedImageView];
0

精彩评论

暂无评论...
验证码 换一张
取 消