Reputation: 1943
I am having trouble on identifying if there is an image on the UIImageView.
First of all, i have a static table with uiimageview inside. when user press new page or load the data, they both proceed to the same static table.
But now i want the uiimageview on the new page could show some image placeholder to tell the user can insert pic there. However for the old page with image data, i want to the placeholder to disappear when there is image inside the UIImageView.
How can i do that? I am using the code below to load the data;
- (void)viewDidLoad
{
self.set11.image = [UIImage imageWithData:[self.role valueForKey:@"set1"]];
self.set111.image = [UIImage imageWithData:[self.role valueForKey:@"set1"]];
self.topview.image = [UIImage imageWithData:[self.role valueForKey:@"toppic"]];}
Upvotes: 0
Views: 118
Reputation: 1752
Use :
if(imageView.image){
//image in UIIMageView
}else{
//No image !!!
}
in your case
self.set11.image = [UIImage imageWithData:[self.role valueForKey:@"set1"]];
if(self.set11.image){
//image in UIIMageView
}else{
//No image !!!
}
Upvotes: 3
Reputation: 49730
you can check like this :-
if(yourImageView.image != nil)
{
//Image in image View
}
else
{
// image Not Found
}
Upvotes: 1