0

I am making a tvOS app in UIStorybord. I want to make a blur of my current UIViewcontroller based on the previous UIViewController in the navigation Stack. I am using UIVisualEffectView class for that. So i have my firstViewController, i added UIImageView on that. On the next UIViewController (this VC will be pushed on top of my FirstViewController) i added UIVisualEffectView on self.view in storyboard and then added a UIButton inside the view property of UIVisualEffectView, but i am not getting any blurring effect.

I have not written any code for that. Do i have to write the codefor that? I want to do every thing in the storyboards as it is much easier to add constraints in the storyboard instead of doing that in the code.

Here is the image of the Storyboard Image

Any help will be highly appreciated. Thanks

Madu
  • 4,849
  • 9
  • 44
  • 78
  • Please reread & edit your question, it's almost not understandable. Do you want to blur one view and then display the new one on top? What exactly do you want to blur and where and what should be displayed on top? It does not make sense to blur one VC if you display a new one on it, except it's content is not full screen or transparent... Can you post a picture of what you want the result look like? – Julian F. Weinert Nov 09 '15 at 11:42
  • Actually i want to get a blurred background of my previous UIViewController in navigation stack for my current View Controller. Same like when you swipe down on you iPhone home screen and get a spot light search. – Madu Nov 09 '15 at 11:48
  • Then please clarify your question, I'll add an answer either way – Julian F. Weinert Nov 09 '15 at 12:13

1 Answers1

0

The default navigation transition moves the previous viewController to the left and then removes it from the view stack.

You will need your viewController to implement to UINavigationControllerDelegate protocol:

- (id<UIViewControllerAnimatedTransitioning>)navigationController:(UINavigationController *)navigationController animationControllerForOperation:(UINavigationControllerOperation)operation fromViewController:(UIViewController *)fromVC toViewController:(UIViewController *)toVC;

Now you will need to implement your custom animator object that implements UIViewControllerAnimatedTransitioning and return an instance of that class in the UINavigationController delegate method mentioned above.

To simplify the process you can add a UIVisualEffectView to your second viewController. You'll place your views content inside the effect view.

In your custom animator you only need to animate the target viewController and keep the source viewController where it is.

Julian F. Weinert
  • 7,474
  • 7
  • 59
  • 107