Customize UIImagePickerController to have a white border - ios

I'm trying to reach a controller that looks similar to this:
Notice the customize size of the capture screen, and the white border around it.
I know, it's impossible to change the background color of UIImagePickerViewController, so im trying to implement an overlayView to go above it.
The main issue is that i need to make a mask view that will show the camera in the middle of the overlay view, and so far i came up short.
Any ideas on how to implement this? How can i easily make a mask view that cuts a "hole" in the overlay view to see the camera underneath it?
Thanks!

I would suggest creating your custom camera. It will let you put all sorts of overlays etc. Check out AVCaptureSession There is also a bunch of tutorials online describing how to do it very easily. First result from Google search: https://dannygtech.wordpress.com/2014/03/04/custom-camera-on-ios-avcapturesession-avcapturevideopreviewlayer-tutorial/

Related

Swift: Zooming image with scrollView like Facebook

I am trying to build an iOS app that will have the structure of Facebook's feed:
A vertical collection view that will have cells. Each cell will consist of image and text.
In fact, I am building my app with the help of this video by LetsBuildThatApp (this guy rocks by the way).
Currently, I am able to touch the image and animate it to full width, and also pan to dismiss it if velocity on Y-axis is more than a specific threshold.
What I want to achieve after that is to also be able to pinch/double tap to zoom. Like this:
I searched around and found some great articles on how to use UISCrollView to zoom. [Article1, Article2].
The problem is that I use autolayout to perform animations but these articles either use Storyboards or frames to position the image in the center of the scroll view [or at least this is how I understand it]. And also they don't involve any animations to start with.
Also, I don't want to present or push a view controller onto the navigation controller stack. I would rather animate the view on top of the base view as I do now.
Any idea on how to achieve this?
Thank you in advance!

Is it possible to add the blur effect in video?

I'm working on video part in my Application. I would like to show my video with the blur effect in top and bottom. Is this possible in Swift?
Reference: Twitter has this functionality in their Application.
Yes of course you can if twitter did it.
Just add on top of your Video Layer, a Visual Effect View with Blur. If you use Storyboards, you can just drag and drop this view, add constraints, and it will work.

Do I need layoutIfNeeded() or kCAGravityResize for my CALayer?

I have successfully started a session on a sublayer but the video looks like this. Do I need to add self.view.layoutIfNeeded() somewhere? If so where can I put it? I've put it in a few different areas but no go. Should I be using something called kCAGravityResize? My goal is to have the video on its own layer filling half screen and then have a tableView layer for graphics text etc filling the other half of the screen. How would I do this?
To debug this you can give the preview layer a background color. This allows you to see where the layer is, and where the video on that layer is.
I don't know your exact view hierarchy but the problem here is often that the view resizes, but the preview layer keeps the same frame.
You can subclass your view and update the preview layer's frame in layoutSublayersOfLayer:.
I seem to have got it working using viewLayer.masksToBounds. The video preview now follows the size I set for the UIImageView.

Masked scrollable button list

I want to implement scrollable button list which are displayed inside popup. I would need some kind of masking, but buttons should also work inside mask. Any suggestions how to do it?
It is possible to achieve this with CCMask class but this is pretty slow way to do it as mask has to be applied every update.
If you use this class you will also loose button detection so you will have to play with touch detection. You will also nead a lot of tweaks to position mask & objects exactly where you want.
When you will finish everything it will not be as good as you thought it will be .. The feeling of scrolling will just not be OK, since there will be masking lag ...
It is better to hide hidden parts of scrollable items with some kind of "window" images

Fill Color Selected Area in UIView upper Layer

I am trying to develop paint type App for iPhone/iPad. I have done 70% but one functionality is taking time to complete it. I have added To Fill Selected Area with Selected Color functionality inside it. I did it but it is taking to much time or working too slow. Due to this functionality, whole App become freeze.
Structure of Drawing View :-
UIView(Parent View)
-UIImageView(SubView1)-To keep image as a background
-UIImageView(SubView2)-To draw color or draw line
In above structure, Parent view is work as a Canvas View and Subview1 is lowerview and Subview2 is upperview.
My approach :-
1)finding currnet point.
2)getting pixtel color.
3)get screen shot for whole screen.
4)get array for those pixtel who have a same pixtel color as select pixtel in current screen shot
5)now we use 4Q pixtel fill color for identifying pixtel who is connected with selected pixtel and making array for all those pixtel.
6)After getting the final array for the pixtel, we draw a pixtel with selected color.
Any one help.
I need a another implementation for Flood fill with a more smooth way functionality.
Pls provide me a Code sample.
Thanks in Advance.
Use a stack based flood fill: http://www.drowningintechnicaldebt.com/ShawnWeisfeld/archive/2006/12/04/stack-based-flood-fill-algorithm.aspx
I found this and it worked a treat for me!
https://github.com/Chintan-Dave/UIImageScanlineFloodfill
Very easy to implement too.

Resources