UIImage orientation issue in Share Extension - ios

I am trying a Share Extension that iOS provides. Having trouble while getting UIImage from gallery host.
The image is is not in appropriate orientation. Any suggestion how can i get proper image from Photos as host to Share extension.
I am using loadItemForTypeIdentifier of NSItemProvider to get image object.
Kindly help, thanks in advance.

Related

How to pass imageView as source to QuickLook preview

After picking an image from UIImagePickerController, I am trying to pass that imageView as a source to QuickLook preview which requires URL as a data source.
I am not interested to write the image into any document storage to create a URL, which will create a copy image again in the disk.
Note:
I am using a scanner SDK where it will return a UIImage as a result, so i need to use that UIImage for QuickLook preview.
Any suggestion to achieve this?
You might want to checkout this method (https://developer.apple.com/documentation/uikit/uiimagepickercontrollerdelegate/1619126-imagepickercontroller). One of the arguments to this method is an 'info' dictionary which can be used to get the image URL. Use the key 'imageURL'.

iPad image is getting cropped/resized while using image picker controller in objective c

When I use image picker to take photos using iPad camera , the photos are automatically getting resized/cropped while storing it.The same code is working fine with iPhone.Can anyone please help me to find out a solution for this. I am getting this in iOS 9.x.I need original images to be displayed.
Thank you very much in advance.
My issue got resolved when I changed
UIImage * image = info[UIImagePickerControllerEditedImage];
to
UIImage * image = info[UIImagePickerControllerOriginalImage];
in didFinishPickingMediaWithInfo method.

How To Load The Image Set(The Bundle) From Images.xcasset in iOS

When I am developing apps in iOS before, I always put the image sources of the app at the root directory of the project, and then I will load them using [UIImage imageNamed:#"image.png"]. I did't even include various sizes and resolutions such as image#2x or image#3x. But I am afraid this is not a good practice, because I cannot deal with different screen resolutions.
Now, I want to make use of the Images.xcasset to store all my image sources so that I will be able to load just the bundle name, and hoping that the system will pick the image with the right resolution automatically. Therefore, I made a test and place my image set under Images.xcasset and named it as images, and then in my UIViewController.m I am trying to load the image by calling [UIImage imageName:images]. As a result, it didn't work. So I searched for an answer and found out that I should call [UIImage imageName:#"images60x60#2x.png"] in order to load the the 60pt #2x image.
But I think this still did not solve my problem, because I am still choosing which image to load. Is there a way to load the entire image set or load the image according to the resolution of the screen?
Please help. Many Thanks.
EDIT: Added Screen Shots
I use AppIcon as a test
As you said at last that you are using AppIcon as a test. Please don't AppIcon it is made for internal use. try to create you own imageSet and use that. It should work.
Two things :
As said Ankit, do not use App Icon, use your own set
do not use a file suffix. Just reference [UIImage imageName:#"MyImage"] (not [UIImage imageName:#"MyImage.png"])

Load image from image url to show animation in UIImageview

I m getting more than 200 image url from web service and i am converting image url to UIImage array and showing animation in UIImageView and its crashing in device and its working fine in simulator? Can you plz provide any solution for this issue.
I think you should handle this job by using the native API:
[UIImage +animatedImageWithImages:(NSArray *)images duration:(NSTimeInterval)duration]

Take photo and store in custom album in Xamarin.iOS

I want to take a photo and save them within a custom album on a iPad.
I tried a lot of things but ended always with wrong image orientation.
My current procedure is:
Take photo with Xamarin.Media and safe image somewhere in my app path
Create custom album if it's not existing
Load image from temporary path and save to the album
Add the image (asset) additionally to the custom album created in 2.
The workflow above is fully working except of saving the correct orientation. After loading an image with library.AssetForUrl() the containing orientation is every time up. Also after converting from asset -> CGImage -> UImage (uiImage.Orientation).
In step 3 I tried to set the orientation the the appropriate one with
var image = new UIImage(tempImage.CGImage, 1.0f, UIImageOrientation.MyOrientation)
and also with the save command
library.WriteImageToSavedPhotosAlbum(image.CGImage, myOrientation, SaveCompletionBlock)
But the orientation is still ignored. I checked this by opening the Album application as well as loading the file in my self written gallery app.
I want to avoid the use of the iOS picker to take photos. This will produce a mess of code!
Or is there any third party library which allows to take photos and store them in a custom album? Which takes care of all the metadata information? It doesn't matter if it's written in objective-c or c#. I will create bindings for it. But it's awful to work with the camera and albums in iOS.
There are tons of hand-made UIImagePickerController alternatives. Some of them:
https://github.com/w5mith/WSAssetPickerController
https://github.com/chute/photo-picker-plus-ios
https://github.com/B-Sides/ELCImagePickerController

Resources