我有一个UIImageView
,其中image
加载了url
。我的问题是,当网址为empty
时,视图会显示填充屏幕空间而没有任何内容。
我想知道如何隐藏此视图是url为空的字符串。
答案 0 :(得分:1)
请检查:
NSString *URL = [YourURL absoluteString];
if(![URL isEqualToString:@"null"])
{
imageView.image=@"img.png";
}
答案 1 :(得分:1)
您可以检查返回的URL字符串的长度,以确定它是否为空
NSString *yourURL
if ([yourUrl length]<1){
imageView.hidden = YES;
}else{
//show imageview with the image
}
我希望这会有所帮助