self.imgView.animationImages = @[[UIImage imageNamed:@"img1.png"], [UIImage imageNamed:@"img2.png"],[UIImage imageNamed:@"img3.png"],];
IOS - how to set image in UIview [closed]
-
01-07-2023 - |
题
I'm working with this project IOS-Image-Swiper
and I'm trying to set images in the view with no success.
self.photos = [[NSMutableArray alloc] initWithObjects:
[UIImage imageNamed:@"green.png"],
[UIImage imageNamed:@"green.png"],
[UIImage imageNamed:@"green.png"],
nil];
Thanks for helping.
解决方案
其他提示
try this one:
UIImageView *myImageView = [[UIImageView alloc] initWithImage :
[UIImage imageNamed :@“uiimage.png"]];
UIView *myUIView = [[UIImageView alloc] initWithFrame :CGRectMake(0,10,20,40)];
myUIView = myImageView;
OR:
UIImageView *background = [[UIImageView alloc] initWithImage:[UIImage imageNamed:@"uiimage.png"]];
[self addSubview:background];
[self sendSubviewToBack:background];
Try this one, Hope it'll help you..
NSArray * imageArray = [NSArray arrayWithObjects:[UIImage imageNamed:@"apple5.jpg"],[UIImage imageNamed:@"green.png"],[UIImage imageNamed:@"red.png"], nil];
imageView.animationImages = imageArray;
imageView.animationDuration = 4;
[imageView startAnimating];
[self.view addSubview:imageView];
不隶属于 StackOverflow