ios - Converting imageNamed to imageWithContentsOfFile: -
My code for my images is
- (IBAction) start: (id) Sender (Animation. Animation Images [[NSARRARA with Objects: [UIImage Image Named: @ "Paddle 1.PGG"], [UIImage Image Named: @ "Paddle 2.PNG"], [UIImage Image Named: @ "Pedal 3 PGN "], [UIMAge ImageNamed: @" Paddle 4.PNG "], Blue]; [Animation Set Animation Recurrence Number: 0]; Animation Animation = 2.5; [Animation F Lu];} This is caching a lot of memory and I was asked to swap my code in the previous question
[UIImage ImageWithContentsOfFile: GetImgWithoutCaching (@ "Paddle 1.jpg")] and
UIImage * GetImgWithoutCaching (NSString * imgName) {NSString * imagePath = [[ NSBundle main bundle] pathForResource: imgName ofType: zero]; return [UIImage imageWithContentsOfFile: imagePath];} What is the correct way to write code? Do I keep that code in my .m Am I
First you should check to use retinal images:
BOOL is the higher revolution = no; If ([[USScreen main screen] gives feedback: Two-selector: @sillector (scale)) {if ([USScreen main screen]. Scale & gt; 1) {Hahirsuxolution = Yes; }} If you are using Retina Picture, add the image name @ 2x, like this:
NSString * noExtFileName = [name String Bedding Path Extension]; If (isHighResolution) {if (! [NoExtFileName hasfix: @ "@ 2x"]) {noExtFileName = [noExtFileName stringbifting string: @ "@ 2x"]; }} // If the image returns only "PNG" type [[NSBindal main bundle] Pathfosource resource: Noctf filename: @ "PNG"];
Comments
Post a Comment