UIButton CustomButton Image Not Appearing

I have a custom button with an image. I had to change the image so I deleted the old one and placed a new one with the same name into my project. But now, no image appears for the button, but if I click on the button it works fine. Here is the code:

//before @implementation 
static NSString *kdetailsIcon = @"details.png";

//in a helper method
UIButton *detailsButton = [UIButton buttonWithType:UIButtonTypeCustom];
[detailsButton setFrame:CGRectMake(276, 8, 44, 44)];
[detailsButton setImage:[UIImage imageNamed:kdetailsIcon] forState:UIControlStateNormal];
[detailsButton addTarget:self action:@selector(showDetailView) forControlEvents:UIControlEventTouchUpInside];
[infoBar addSubview:detailsButton];

I figure the problem is actually something with xcode rather than my code, but I have tried deleting the image files and re-adding them, cleaning the project, deleting the app from my phone before compiling, deleting the derived data, everything I can think of. Any help would be greatly appreciated.

  • Rich text editor library for iOS
  • Starting with Objective-C: To ARC or not to ARC?
  • iOS 8.1 auto rotation
  • Change Height of a UITableViewCell
  • Programmatic language localisation without restart
  • Caret in objective C
  • Solutions Collect From Internet About “UIButton CustomButton Image Not Appearing”

    -First make a clean in your project click in product/clean.

    -Delete this image from directory of your project in Xcode. Them add this image into your paste project. Go to XCode again, in your project go File / Add Files to project_Name.

    search and choose your image and sucess. If not Success,Close/Open Project again.if not sucess again your writing wrong name/extensions of your image!