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.
- What does the property “Nonatomic” mean?
- Getting status “REQUEST_DENIED” after fetching data from google places API
- Cross-compiling ZeroMQ to ARM for use in a MonoTouch iPhone app configure settings
- How to get a correctly rotated UIImage from an ALAssetRepresentation?
- My Tab bar controller disappears after a push segue
- Objective C: Adding Loading View to View Controllers
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!
- Swift: Split a String into an array
- OCUnit tests fail from the command line but work in Xcode when using Keychain Services
- iOS UIWebView app opens link in Safari
- Swift native base class or NSObject
- What does “get” mean in a protocol's property declaration?
- How to work with deferred location iOS 6?
- How can you play a sound of a specified duration using AVAudioPlayer on iOS?
- Random number to print array (Swift)
- Custom completion block for my own method
- Invalid Image Path – No image found at the path referenced under key “CFBundleIconFile”: Icon.png
- Find path for Realm file with Realm React Native to use with Realm Browser
- Drop down list ios swift
- Best way to save data to iOS?
- How do I setup a Unit Test for Swift?
- Xcode 5: “No such provisioning profile was found …” error