Only the else part is not working, if I have an image for the note, every thing is working just perfect, but when i am trying to show the "no_image" image, i just don't see it (there is not error). Looks like a "nil", but the image is in the project, for sure. i am using the same image in other places and other methods and it is working over there. just in the UIButton not working.
//setting the note header data
if (note.imageThumb) {
[photoButton setImage:note.imageThumb forState:UIControlStateNormal];
} else {
[photoButton setImage:[UIImage imageNamed:@"no_image.png"] forState:UIControlStateNormal];
}
1) Are you sure the image is added correctly to the project, so it knows where it is located automatically?
2) Have you tried instantiating the Image on a separate line so you an better debug the root cause.
Is it [UIImage imageNamed:@"no_image.png"]
or
forState:UIControlStateNormal];
or
[photoButton setImage:
The last two I probably would look at together. But because you put it all in one line makes it tougher to figure out what is wrong, or what is really causing the problem.
Is the "@" supposed to be inside the quotes in the code???
Also we have a code button for posting code to this forum so that it keeps its indentation and makes it more readable. Now you just have 5 lines so no big deal, but for the future posts.