IOS-如何在UIview中设置图像
我在做这个项目 我试图在视图中设置图像,但没有成功IOS-如何在UIview中设置图像,ios,github,uiimageview,Ios,Github,Uiimageview,我在做这个项目 我试图在视图中设置图像,但没有成功 self.photos = [[NSMutableArray alloc] initWithObjects: [UIImage imageNamed:@"green.png"], [UIImage imageNamed:@"green.png"], [UIImage imageNamed:@"green.png"], nil];
self.photos = [[NSMutableArray alloc] initWithObjects:
[UIImage imageNamed:@"green.png"],
[UIImage imageNamed:@"green.png"],
[UIImage imageNamed:@"green.png"],
nil];
谢谢你的帮助。试试这个:
self.imgView.animationImages = @[[UIImage imageNamed:@"img1.png"], [UIImage imageNamed:@"img2.png"],[UIImage imageNamed:@"img3.png"],];
UIImageView *myImageView = [[UIImageView alloc] initWithImage :
[UIImage imageNamed :@“uiimage.png"]];
UIView *myUIView = [[UIImageView alloc] initWithFrame :CGRectMake(0,10,20,40)];
myUIView = myImageView;
或:
试试这个,希望对你有帮助
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];
您的问题不清楚,请提供更多详细信息您说您正在尝试在视图中设置图像…您是如何做到这一点的?(您显示的是一个数组,而不是一个视图。)您提到的上述项目有点不同。您必须在该项目中引用整个代码。他们用手势书写自定义视图。还有,你需要清楚地告诉我什么?我通过“UIGraphicsBeginImageContext(self.view.frame.size)”解决了这个问题;[[UIImage ImageName:@“green.png”]drawInRect:self.view.bounds];UIImage*image=UIGraphicsGetImageFromCurrentImageContext();UIGraphicsSendImageContext();card.front.backgroundColor=[UIColor WithPatternImage:image];'请接受我这边的投票,先生@马扬克·贾因
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];