iphone - IOS UIImageView displays with black background -


So I've got this function is that measures UIImages , and I am using it I have to start to be a .png with a UIImageView full transparency My problem is that when the image is displayed, a black rectangular image background the always around with an image Regardless, it is.

It is as well as the scaling method the initialisation UIImageView :

  - (UIImage *) imageWithImage: (UIImage *) image scaledToSize: (CGSize) newSize {if ([[UIScreen mainScreen] respondsToSelector: @selector (scale)]) {if ([[UIScreen mainScreen] scale] == 2.0) {UIGraphicsBeginImageContextWithOptions (newSize, yes, 2.0); } And {UIGraphicsBeginImageContext (newSize); }} And {UIGraphicsBeginImageContext (newSize); } [Image drawInRect: CGRectMake (0, 0, newSize.width, newSize.height)]; UIImage * newImage = UIGraphicsGetImageFromCurrentImageContext (); UIGraphicsEndImageContext (); New image refund; } - (void) addMass: (M *) mass {UIImageView * image = [[UIImageView alloc] initWithImage: [self imageWithImage: [UIImage imageNamed: @ "circle.png"] scaledToSize: CGSizeMake (mass.mass, mass .mass)]]; [Image setbackgram color: [[UIColor alloc] initWithRed: 0 green: 0 blue: 0 alpha: 1]]; Image. Center = [group status]; [Image setbackgram color: [UIColor clearColor]]; [MUST IMAGES ADOBECT: IMAGE]; [Self.view addSubview: image]; }  

You can see I've used [Image setBackgroundColor: [UIColor clearColor]]; to try and set the background color of to clear UIImageView , but it is not working.

All you need to do is

  UIGRIFIIGIJEJentTechWidth Option (new Size, no, 0);  

and the scale factor will be set automatically, and the resulting pixel in the image will be transparent.


Comments

Popular posts from this blog

Editing Python Class in Shell and SQLAlchemy -

import - Python ImportError: No module named wmi -

uislider - In a MATLAB GUI, how does one implement a continuously varying slider from a GUIDE created .m file? -