Blur UILable text line by line - ios

I want to blur the text of my UILabel line by line. Currently I am applying a UIBlurEffect onto the UILabel but this simply blurs the whole view (obviously).
let blurEffect = UIBlurEffect(style: UIBlurEffectStyle.Dark)
let blurEffectView = UIVisualEffectView(effect: blurEffect)
blurEffectView.frame = view.bounds
view.addSubview(blurEffectView)
But I want to make sure, that the user can recognize the lines and even the rough structure of the text like this:
How can I achieve this?

Related

UITableView blurred overlay

In my project I want to achieve a blurred background in a UITableView.
So far I already set up the overlay like this:
let blurEffect = UIBlurEffect(style: .dark)
let blurEffectView = UIVisualEffectView(effect: blurEffect)
blurEffectView.frame = self.view.bounds
blurEffectView.autoresizingMask = [.flexibleWidth, .flexibleHeight]
self.tableView.insertSubview(blurEffectView, at: 0)
Now I got the problem that the blurred overlay is on top of my table cell. See given image. The order should be like this: UITableView (which has a bg-color) - UIVisualEffectView (blurred overlay) - UITableViewCell
How can I put the overlay between the table view and it's cell? Or is there even a better solution to this?
Make your blurred view tableview's background view and it should look correct.
let blurEffect = UIBlurEffect(style: .dark)
let blurEffectView = UIVisualEffectView(effect: blurEffect)
blurEffectView.frame = self.view.bounds
blurEffectView.autoresizingMask = [.flexibleWidth, .flexibleHeight]
self.tableView.backgroundView = blurEffectView

How to have a UIPageView on top of a blur effect?

I am working on an app where I want to have a UIPageView on top of a blur effect. I know how to do it with storyboard, but since I am adding it on top of another view as a subview, I don't see a way to do it. Can anyone help me with this? The code I used to create the blur effect is like this:
self.view.backgroundColor = UIColor.clear
let blurEffect = UIBlurEffect(style: UIBlurEffectStyle.light)
let blurEffectView = UIVisualEffectView(effect: blurEffect)
blurEffectView.frame = self.view.bounds
blurEffectView.autoresizingMask = [.flexibleWidth, .flexibleHeight]
self.view.addSubview(blurEffectView)
actually you can use this method:
self.view.insertSubview(blurView, belowSubview:pageView)
right now page view on top of a blur.

Create custom blur UIView

I have to develop an app that uses a a blur view.
I've tried to use UIVisualEffectView with UIBlueEffect but then I realised that there are just 3 types of blur that you can choose from, without an option to customise the blur.
I need to make a blur that is something between the Light and Dark modes, but I don't know how can I create a custom blur view.
Any idea on how can I do that?
Thank you!
User below code for the blur effect
let blurEffect = UIBlurEffect(style: UIBlurEffectStyle.dark)
let blurEffectView = UIVisualEffectView(effect: blurEffect)
blurEffectView.frame = view.bounds
blurEffectView.autoresizingMask = [.flexibleWidth, .flexibleHeight]
view.addSubview(blurEffectView)
Also you can use below library
https://github.com/ide/UIVisualEffects

How do I make my UIImageView be on top of the Blur Effect in Swift?

I have this camera app im working on and once the picture is taken the view gets blurred including the captured image. I would like the captured image to be on top of the blur effect so It doesnt get blurred and the user could be able to see the picture they took. How would I be able to do that? This is the code I have currently:
if !UIAccessibilityIsReduceTransparencyEnabled() {
self.view.backgroundColor = UIColor.clearColor()
let blurEffect = UIBlurEffect(style: UIBlurEffectStyle.Dark)
let blurEffectView = UIVisualEffectView(effect: blurEffect)
blurEffectView.frame = self.view.bounds
blurEffectView.autoresizingMask = [.FlexibleWidth, .FlexibleHeight]
self.view.addSubview(blurEffectView)
}
else {
self.view.backgroundColor = UIColor.blackColor()
}
Any views added to the effect views content view will not be blurred. Any views behind the effect view will be blurred.

How to create opaque background like in the bottom panel in Swift?

I want to create label with the background color like in the bottom panel of iOS7-8, something like this:
Or create a view and inside of it put label. How can I achieve this result?
You can use blureffect
For example
let blurEffect = UIBlurEffect(style: UIBlurEffectStyle.Light)
let bluredEffectView = UIVisualEffectView(effect: blurEffect)
bluredEffectView.frame = CGRectMake(100, 100, 200, 200)
self.imageview.addSubview(bluredEffectView)
Screen shot

Resources