Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/github/3.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
IOS-如何在UIview中设置图像_Ios_Github_Uiimageview - Fatal编程技术网

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];