UIImage initWithContentsOfFile doesn't work
I have question: I want to avoid [UIImage imageNamed:].
So i did:
UIImage *prodImg = [[UIImage alloc] initWithContentsOfFile:@"myimage.png"]; controller.productImg.image = prodImg; [prodImg release];
But now the image is not shown anymore.
Does anyone know how to get that to work?
Solutions Collect From Internet About “UIImage initWithContentsOfFile doesn't work”
The above code is not working because correct way to do it is-
NSString *thePath = [[NSBundle mainBundle] pathForResource:@"default" ofType:@"jpeg"]; UIImage *prodImg = [UIImage imageWithContentsOfFile:thePath]; controller.productImg.image = prodImg; [prodImg release];
- Categories/Interfaces From Static Libs Not Autocompleting?
- Voip(Voice over IP) missing in Xcode 9
- How to create a custom keyboard
- How to update FBRequest.requestForMe() on facebooksdk v4.0.1?
- How to detect when a UIWebView has completely finished loading?
- How to set my web view loaded with already login user -iPhone
- How do I get the iOS Device and Version in Monotouch
- How to make MPMoviePlayerController ignore the mute switch
- Is there a way to reset the app between tests in Swift XCTest UI in Xcode 7?
- Add private key to certificate or vice versa
- Launch GUI app on iOS 5 through the command line (jailbreak)
- Swift: Have SearchBar search through both sections and not combine them
- Working with Objective-C blocks with Swift
- How to switch to front camera in Swift 2?
- Tap gesture on multiple imageview inside scrollview not firing event , only first imageview tap gesture working?