UIImageView 属性 accessibilityIdentifier
来源:互联网 发布:汽车维修软件免费版 编辑:程序博客网 时间:2024/05/16 08:50
有时候我们使用ImageView的时候 想要知道现在的显示的图片是placeHolder的图片还是加载完成或挑选好的图片,但是tag属性只能拿到却不能判断,当然,加几个bool属性也可以完成,但是会有些复杂,如果可以在给imageview 赋图片的时候给图片加个标记,那么下次判断一下标记是不是placeHolder就可以了,很简单。
UIImageView * picView = [[UIImageViewalloc]initWithFrame:CGRectMake(10,90, 50,50)];
picView.layer.cornerRadius =3;
picView.userInteractionEnabled =YES;
picView.layer.masksToBounds =YES;
picView.image = [UIImageimageNamed:@"add_pic.png"];
[picView.imagesetAccessibilityIdentifier:@"add"];
判断
if ([picView.image.accessibilityIdentifierisEqualToString:@"add"])
{
[self chooseImageFromAblum:^(UIImage*image) {
picView.image = image;
// 给新图片的AccessibilityIdentifier赋新值
[picView.image setAccessibilityIdentifier:@"new"];
}];
}else{
[self blowUpImageWithPic:picView.image];
}
这样会方便很多,减少bool变量过多带来的问题。
- UIImageView 属性 accessibilityIdentifier
- AccessibilityIdentifier属性使用
- Image的AccessibilityIdentifier属性使用
- AccessibilityIdentifier
- UIImage 的 AccessibilityIdentifier 属性的使用
- UIImageView属性
- UIImageView属性
- UIImageView属性
- UIImageView属性
- UIImageview的contentMode属性
- UIImageView contentMode属性
- UIImageView 的contentMode属性
- UIImageView之userInteractionEnabled 属性
- UIImageView的contentMode属性
- UIImageView的一些属性
- UIImageView 的contentMode属性
- UIImageView常用属性
- UIImageView 属性 方法
- CDN技术初识
- Reddit算法分析
- 如何在客户端生成GUID(Javascript)
- Servlet+Jsp+Tomcat+Jstl+El+Jdbc+mysql+C3p0
- 《InsideUE4》UObject(四)类型系统代码生成
- UIImageView 属性 accessibilityIdentifier
- web编程从入门到项目实战-ESLint篇
- 母函数
- JavaScript历史与ECMAScript
- 使用 Docker 一步搞定 ZooKeeper 集群的搭建
- JavaScript内部实现
- LESS语言简介
- Binary Heap(二叉堆)
- jQuery.extend 函数详解