i would like to know if i can load different images using an UISlider.
The best will be to have the same slider ( let say it is a slider... ) as the application photo of the ipad ( the mini photo slider at the bottom ).
Do you think i can do the same as the application photo and how ?
Related
I'm new to iOS app development and I begun to learn from this great tutorial:
Start Developing iOS Apps (Swift)
https://developer.apple.com/library/content/referencelibrary/GettingStarted/DevelopiOSAppsSwift/WorkWithViewControllers.html#//apple_ref/doc/uid/TP40015214-CH6-SW1
Everything looks great but when trying to load an image from "Camera roll" on the simulator, I get the image shown oversized and filling all the iPhone simulator screen instead of just showing into the UIImageView box as shown on tutorial images.
The funny fact is that also downloading the correct project provided at the end of the lesson (see the bottom of the page) I get the same issue.
Googling around I get some ideas to insert a:
// The info dictionary may contain multiple representations of the image. You want to use the original
guard let selectedImage = info[UIImagePickerControllerOriginalImage] as? UIImage else {
fatalError("Expected a dictionary containing an image, but was provided the following: \(info)")
}
// Set photoImageView to display the selected image
photoImageView.image = selectedImage
photoImageView.contentMode = UIViewContentMode.scaleAspectFit
// Dismiss the picker
dismiss(animated: true, completion: nil)
after loading image from the camera roll, but lead to no results...
I'm using Xcode 9.2 with deployment target 11.2 and iPhone 8 plus as a target for the simulator.
Any help is apreciated.
It happens because the sample code is only restricting the proportion of the UIImageView (the 1:1 constraint you added in storyboard). In this way, it will always keep your imageView squared but will not limit the size.
As the sample tells, you entered a placeholder size, that is only kept until you set some image on it. When you enter a new image on the UIImageView it changes to the size of the image you set (in your case, probably a bigger image for the camera roll). That's probably why its getting so large.
I think the easy way to fix this to add other constraints in storyboard to limit the size (like actually size or border constraints).
When you implement a cameraOverlayView for a UIImagePickerController, this view appears while you're taking the photo and after the photo has been taken, providing you with an opportunity to cancel or retake the photo. The problem I'm seeing is if your cameraOverlayView is on top of the photo preview area, when you take the photo and it shows you the preview, the photo you took doesn't align with the cameraOverlayView anymore. The entire photo preview pane has been moved down ~50 points while the cameraOverlayView has stayed in place. This is a problem when you need the photo to be aligned perfectly with the view.
How can this be adjusted so the two are perfectly aligned - while taking the photo and after it has been taken?
Notice how the whole preview area is pushed down after taking the photo.
I had a similar problem and came up with the following workaround:
if (IPhone5 || IPhone5c || IPhone5s)
{
imagePicker.cameraViewTransform = CGAffineTransformTranslate(imagePicker.cameraViewTransform, 0, 30);
}
else if (IPhone6 || IPhone6Plus)
{
imagePicker.cameraViewTransform = CGAffineTransformTranslate(imagePicker.cameraViewTransform, 0, 44);
}
This ensures that the picture that was taken will have approximately the same center as the camera preview layer (in portrait orientation).
At the moment, I am in the process of trying to convert my iOS app over to Windows Phone 8, however, in my iOS app, I used the UIImagePicker's allowsEditing method to get what happens in the image below.
In the image below, the user can resize the picture they have selected so they can use only the part of the picture they selected in the app, while also the picture they select gets cropped into a square for the app to easily use too.
My question is, now that I am making the app using the Windows Phone 8 SDK, is there a simple method to get this same functionality, or will I have to program this functionality in myself?
Thank you very much.
Jon.
You should use the PhotoChooserTask with the PixelHeight and PixelWidth properties:
photoChooser.PixelHeight = 612;
photoChooser.PixelWidth = 612;
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
I'm using UIImagePickerController to take pictures. It's quite simple. But I have a problem: There is always a "Preview" view to let me "Retake" or "Use". Which is not what I want. I want to save my pictures straight away inside my photo albums.
I've found some articles about this problem, here are some of them:
Link 1
Link 2
Basically they are using a OverlayView which can solve the problem. But there is new problem. I can't use volume up key to take pictures anymore after I use OverlayView. Are there another solution to disable the stupid "Preview" ?
Thanks
You could access the camera directly and not use UIImagePickerController at all.
Check out the following classes:
AVCaptureSession
AVCaptureDevice
AVCaptureDeviceInput
AVCaptureVideoDataOutput
With these classes you can display your own camera preview and save the image when button is pressed.
There is example here:
http://developer.apple.com/library/ios/#qa/qa1702/_index.html