swift camera edit frame after take photo - swift

I am always helping with Stack Overflow. I have a question about programming Swift cameras.
My app has the ability to load photos from a camera / photo album and put them into ImageView. At first, I put the image / image into the imageview immediately, but it is difficult to put it in the desired position as it is.
So I pressed the camera shutter button and inserted the editing function. I used the following code:
imageController.allowsEditing = true
imageController.showsCameraControls = true
However, in this case, only the square white line frame appears in edit mode. Can I set the white line frame size proportionally? And can I capture the photos in that frame?
Please help me. It is very difficult to find a way. Thank you.

Related

Captured Image Squeezed After Taking a Picture : Swift

Short and simple, My captured image gets squeezed from both sides when loading it on the preview.
Long version: I am currently using the CameraManager Pod found at https://github.com/imaginary-cloud/CameraManager/blob/master/camera/CameraManager.swift. My problem is that after I take a picture, it squeezes the image a little bit on both sides. The width is not what I see. The bounds of my preview (what I see through the camera) is view.frame.bounds and my bounds of the imageView (what I just captured) is preview.frame.bounds. If need be, I can take a image of whats happening if you need more information.
If you need the code just comment and I can show you. Any feedback is greatly appreciated.
The problem was that I wasn't setting the contentMode of my image view. All I had to do was add this line
imageView.contentMode = UIViewContentMode.ScaleAspectFill
Duplicate of:
How to manage UIImageView content mode?
and
capture image is stretched using avcapture session
Sorry for posting a question without doing thorough research. I wasn't Google-ing the right query.

Image aspect ratio swift ios

So, I'm learning iOS Swift. I'm going by some tutorials, and I'm stucked at image positioning.
I'm trying to figure out how uploaded picture is rescaled and positioned.Since I cannot post the screenshot, image that should be shown in my simulator as whole, I can only see like 25% of the picture. Should I change something in Attributes or in Size Inspector?
What I did so far (clearly wrong), was setting Intrinsic Size field -> select Placeholder, w/h = 320.
Then, I pinned and selected Aspect Ratio.
Any help, please?
Thanks.
If you're asking how to make sure an image fills a UIImageView:
myImageView.contentMode = UIViewContentMode.ScaleAspectFill
You may also need to set constraints if you placed your image view in interface builder.
It's not entirely clear from your question how you want it positioned, but hopefully these get you on the right path.

How to add effects to UILabel

I've been searching for that many time ago and I can't find a solution. I have a animated label that crosses the screen of the iPhone (like the title of a song does in the Music app.Well, I'd like to add the "fade in/out" effect like the music app has. The easy solution is open Photoshop and create this simple image and then add it up to the label. Well, under the label I have an image with black backgroud. The image can be zoomed in and then the image with the fade in/out effect can be seen, and it doesn't look well. Is there any possibility to do this programatically? Thanks
PD: if there's another possibility rather than doing this programatically, I'll apreciate the answer as well.
Edit: Here's the image capture of the problem
I'll approach it in a non-programming way.
The image reference you gave us for the Music app you seem to be emulating has a different gradient than the one you drew in the second image.
If you notice in the image, the gradient has not fully completed its transition from clear to black before the words are cut off. I would say in photoshop run the gradient from clear to 80% alpha black and then draw a 100% alpha black rectangle to finish it off as per image. The white is just showing you what it looks like without the black background.
Now as for the zooming. Correct me if I am wrong, but it sounds like you want a viewing window for the image so that once you have zoomed into it, it will fade to either side, but still be viewable/movable in the center. This means that the image has to be zoom-able, but once you have zoomed the "fade in/out" should not be zoom-able.
Just make sure you aren't scaling the fader by keeping it separate from the scrollView of your background image.

Image "frame/window" on iphone

I have numerous photos in portrait and landscape format. I want to be able to display a "crop" of the photo in a UIImageView on the iphone. If the picture is in landscape format I want it to resize to fit the frame, if it is in portrait format I need it to resize to fit the width, and then be cropped at the top and bottom. As if there is a "window" over the image - so it looks like a landscape picture.
It would be even better if this could be a UIButton - although I am aware that I can use touchesBegan and such on images to make it behave like a button if needs be.
Thanks for any help you can give me.
Thanks
Tom
In an ImageView, you can change the View Mode to Aspect Fill. It will give you the right scaling/cropping you want.
For interactions, you can use a Custom button with no drawing at all (no Title, no Image, no Background) with the same size as your ImageView. That would be safe with regards to the image aspect. I've tried similar stuff using the button's Background or Image properties, it can have some undesired effects (I've ran into a resizing issue on iOS 3.1.3 for instance).
1°) To Crop the Image, try to add a method to UIImage class to do it (you can google it without problem, or even on StackOverFlow)
2°) To add a "window" over your image, just add an UIImageView over your image wich has transparency. It should work ;-)
3°) To know when an image is touched, you can use "touchesBegan" to detect which image were selected. But I think it's the last of your problems ^^
What you cant to achieve isn't so hard, just to it step by step !
If you want more help in one step, say it. But I can't code it all for you ;-)
Good Luck

image Gallery in iPhone

I need to Create an Image Gallery that may be use concept of scrolling and paging together.
When I click on a button, it will open a new view in landscape mode. This view is for my Image Gallery..
It shows 5 Images:
Centered Large Image With its description on Bottom.
Next Coming image on left side, This image is slightly tilled at some angle, Without any description at bottom.
next to next coming image on left to 2nd image.
previous image on right side, This image is slightly tilled at some angle, Without any description at bottom.
Previous to Previous image on right of 4th image
Moreover, all images should be scrollable, like when I scroll 2nd image, it will move to Center and show its description and image which is already centered move to previous image.
Sorry for my confused English, here's an example of what I am trying to obtain.
I tried for basic code of paging and scrolling but unluckily nothing helpful.
Could you give me some pointers?
Check out flowcover (see this question: Open source CoverFlow library for iPhone), which should get you started.
I think someone reported flowcover doesn't work on iOS 4.0, I haven't tried yet, ofcourse.
But, you can also take a look to this OpenFlow project, It will be help you I guess. Many people has builts their app on this library.