简体   繁体   English

如何分配UIImageView PlaceHolderImage

[英]How to assign UIImageView PlaceHolderImage

I am trying to assign a placeholderimage in my UIImageView but am getting this error 我正在尝试在UIImageView分配一个占位符图像,但出现此错误

No visible @interface for 'UIImage' declares the selector 'placeholderImage:' 'UIImage'的可见@interface没有声明选择器'placeholderImage:'

This is how I thought I might be able to do it... obviously wrong but anyway this is what the code looks like. 这就是我以为我可以做到的方式...显然是错误的,但是无论如何这就是代码的样子。

firstSpaceImageView.image = [[UIImage imageNamed:@"CA.png"] placeholderImage:[UIImage imageNamed:@"placeholder.png"]];

any help would be greatly appreciated. 任何帮助将不胜感激。

-[UIImageView setImageWithURL:placeholderImage:] is part of AFNetworking . -[UIImageView setImageWithURL:placeholderImage:]AFNetworking的一部分。 You need to include it to get this method. 您需要包括它才能获得此方法。

There is no property called placeholderImage on UIImage (or on UIImageView). UIImage(或UIImageView)上没有称为placeholderImage属性。 If you want to make your own placeholder solution, this question will help. 如果您想制作自己的占位符解决方案, 此问题将有所帮助。

PS: Even if there was such a property, the setter method would be setPlaceholderImage: rather than placeholderImage PS:即使有这样的属性,setter方法也将是setPlaceholderImage:而不是placeholderImage

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM