[英]How do I check if UIImage is empty in swift?
This is my code but it seems the conditional "if" check for UIImage being empty is not executing. 这是我的代码,但似乎没有执行对UIImage为空的条件“ if”检查。 Is it the wrong way of checking if UIImage is empty?
检查UIImage是否为空是错误的方法吗? I have also tried
我也尝试过
if allStyleArrays[i][ii][iii] as UIImage? == nil {
...
}
And not working, please if none of those methods checks, what is the correct way? 而且不起作用,如果这些方法都不检查,正确的方法是什么?
Thanks. 谢谢。
Code: 码:
for var i = 0; i <= allStyleArrays.count; i++ {
if i == allStyleArrays.count {
self.performSegueWithIdentifier("toStylistReviewAndConfirm", sender: self)
} else {
for var ii = 0; ii < allStyleArrays[i].count; ii++ {
for var iii = 0; iii < allStyleArrays[i][ii].count; iii++ {
if allStyleArrays[i][ii][iii] as UIImage? == UIImage(named: "") {
} else {
switch i {
case 0:
styleN[0].append(allStyleArrays[i][ii][iii])
//print("style 1 \(style1.count)")
break
case 1:
styleN[1].append(allStyleArrays[i][ii][iii])
//print("style 2 \(style2.count)")
break
default:
styleN[2].append(allStyleArrays[i][ii][iii])
//print("style 3 \(style3.count)")
break
}
}
}
}
}
}
尝试
if allStyleArrays[i][ii][iii].imageAsset == nil
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.