iPhone: How do I get the file path of an image saved with UIImageWriteToSavedPhotosAlbum()?

I finally found out the answer. Apparently the UIImage methods strip out metadata and so using UIImageWriteToSavedPhotosAlbum is no good. However in ios4 Apple put in a new framework to handle the photo library called the ALAssetsLibrary. First you need to right click on the Targets and in the build part, add the AlAsset Framework … Read more

How can I change the color of a UIImage? [duplicate]

The accepted answer is correct, but there is a much more easy way for UIImageView: Obj-C: UIImage *image = [UIImage imageNamed:@”foo.png”]; theImageView.image = [image imageWithRenderingMode:UIImageRenderingModeAlwaysTemplate]; [theImageView setTintColor:[UIColor redColor]]; Swift 2: let theImageView = UIImageView(image: UIImage(named:”foo”)!.imageWithRenderingMode(UIImageRenderingMode.AlwaysTemplate)) theImageView.tintColor = UIColor.redColor() Swift 3: let theImageView = UIImageView(image: UIImage(named:”foo”)!.withRenderingMode(.alwaysTemplate)) theImageView.tintColor = UIColor.red

How to display a base64 image within a UIImageView?

You don’t have to encode it. Simply make a NSUrl, it knows the “data:”-url. NSURL *url = [NSURL URLWithString:base64String]; NSData *imageData = [NSData dataWithContentsOfURL:url]; UIImage *ret = [UIImage imageWithData:imageData]; As mentioned in the comments, you have to make sure that you prepend your data with data:image/png;base64, or else your base64 data is useless.

How to get the size of a scaled UIImage in UIImageView?

Objective-C: -(CGRect)frameForImage:(UIImage*)image inImageViewAspectFit:(UIImageView*)imageView { float imageRatio = image.size.width / image.size.height; float viewRatio = imageView.frame.size.width / imageView.frame.size.height; if(imageRatio < viewRatio) { float scale = imageView.frame.size.height / image.size.height; float width = scale * image.size.width; float topLeftX = (imageView.frame.size.width – width) * 0.5; return CGRectMake(topLeftX, 0, width, imageView.frame.size.height); } else { float scale = imageView.frame.size.width / image.size.width; float … Read more

add UIImage in CALayer

This is a general answer for the sake of future viewers. It is based on the question title rather than the details of the original question. How to add a UIImage to a CALayer You can add an image to a view’s layer simply by using its contents property: myView.layer.contents = UIImage(named: “star”)?.cgImage Note that … Read more

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)