iPhone, “More than maximum 5 filtered album lists trying to register. This will fail.” Error

I think you are not checking the source type. You might be doing self.sourceType =UIImagePickerControllerSourceTypePhotoLibrary; If this is the case, then you have to check the source type before assigning it directly. like if ([UIImagePickerController isSourceTypeAvailable: UIImagePickerControllerSourceTypePhotoLibrary]) { // Set source to the Photo Library self.sourceType =UIImagePickerControllerSourceTypePhotoLibrary; } I hope it helps

Resize UIImage with aspect ratio?

After you set your screen rect, do something like the following to decide what rect to draw the image in: float hfactor = value.bounds.size.width / screenRect.size.width; float vfactor = value.bounds.size.height / screenRect.size.height; float factor = fmax(hfactor, vfactor); // Divide the size by the greater of the vertical or horizontal shrinkage factor float newWidth = value.bounds.size.width … Read more

Save images with phimagemanager to custom album?

This is how I do: At the top: import Photos var image: UIImage! var assetCollection: PHAssetCollection! var albumFound : Bool = false var photosAsset: PHFetchResult! var assetThumbnailSize:CGSize! var collection: PHAssetCollection! var assetCollectionPlaceholder: PHObjectPlaceholder! Creating the album: func createAlbum() { //Get PHFetch Options let fetchOptions = PHFetchOptions() fetchOptions.predicate = NSPredicate(format: “title = %@”, “camcam”) let collection … Read more

Most efficient way to draw part of an image in iOS

I guessed you are doing this to display part of an image on the screen, because you mentioned UIImageView. And optimization problems always need defining specifically. Trust Apple for Regular UI stuff Actually, UIImageView with clipsToBounds is one of the fastest/simplest ways to archive your goal if your goal is just clipping a rectangular region … Read more

How to crop the UIImage?

Try something like this: CGImageRef imageRef = CGImageCreateWithImageInRect([largeImage CGImage], cropRect); image = [UIImage imageWithCGImage:imageRef]; CGImageRelease(imageRef); Note: cropRect is smaller rectangle with middle part of the image…

Swift: Creating an array of UIImage

You have two problems (and without a regex!) 1. You aren’t creating an array. You need to do: var logoImages: [UIImage] = [] or var logoImages: Array<UIImage> = [] or var logoImages = [UIImage]() or var logoImages = Array<UIImage>() 2. If you want to add new objects to an array, you should use Array.append() or … Read more

Add transparent space around a UIImage

In Swift you can write an extension to UIImage that draws image with insets around it. Swift 3: import UIKit extension UIImage { func imageWithInsets(insets: UIEdgeInsets) -> UIImage? { UIGraphicsBeginImageContextWithOptions( CGSize(width: self.size.width + insets.left + insets.right, height: self.size.height + insets.top + insets.bottom), false, self.scale) let _ = UIGraphicsGetCurrentContext() let origin = CGPoint(x: insets.left, y: insets.top) … Read more

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