Currently we have a Visual Effects View that was added in storyboard like so:
The view is presented modally but for some strange reason I can see the image underneath blurred during the transition but when the transition is complete the blur turns a dark gray:
No code has been written yet, I'm trying to do this all in storyboard.
You need to set the presentation style of your second view controller.
Select your second view controller
From the Attributes Inspector set Presentation to Over Current Context
Note: Make sure your second view controller is presented modally.
Related
So In my main storyboard one of my view controllers view is smaller than it should be, making that part of the UIView untouchable to the users... I don't know if its a tool bar or some weird inherited view from the previous view controller as it does have a relationship to the previous view controller
tried removing tool bar, I even put my tableview over top of the view making it bigger, but it is unusable on the iPhone after the build
I just need it removed, its a grey bar
I am going to assume that gray is being passed over to your present view controller, I would remove the segue to check if the view updates its constraints, if so remove the previous view controller and embed it to the previous to remove the bar
My app has an interface that is set up so that when I click a button, a view controller will be presented modally. In that view controller, there is nothing but a UIVisualEffectView. When I run my app, it works but then after a second the UIVisualEffectView turns gray. Why is it doing that?
Here is a link to a GIF showing my problem:
click here to view gif
The problem is with the way you present your UIVisualEffectView over the background view. Since you are using some sort of full-screen presentation the underlying view is stopped being updated in order to save resources.
You should be able to get this to work by adjusting the presentation style, such as:
myEffectView.modalPresentationStyle = .overCurrentContext
Edit
Since you said in a comment that you're using Interface Builder, you can also adjust this there by selecting your UIViewController that contains the UIVisualEffectView and adjusting its properties:
I wonder what the difference between current context and over fullscreen is?
When I switch between them I don't see any changes in my app. All the animations look the same etc.
There aren't any visual differences if you are presenting a view controller from a view controller that is already in full screen mode. However, if the presenting view controller isn't in full screen mode, the current context will make a different. For example:
Left: before present, the current view controller is not in full screen mode
Middle: presenting a new view controller with full screen
Right: presenting a new view controller with current context
A full list of comparison of different presentation mode available here on Github.
fullScreen:
The presented view covers the screen (fullscreen).
currentContext:
The UIModalPresentationCurrentContext style covers a specific view controller in your interface. When using the contextual style, you designate which view controller you want to cover by setting its definesPresentationContext property to true.
When presenting a view controller using the
UIModalPresentationFullScreen style, UIKit normally removes the views
of the underlying view controller after the transition animations
finish. You can prevent the removal of those views by specifying the
UIModalPresentationOverCurrentContext style instead. You might use
that style when the presented view controller has transparent areas
that let underlying content show through.
Read more about presenting viewControllers here.
How can I create a view controller with a transparent background that overlays another view controller where the bottom view controller is still visible in iOS 9? The way that works in iOS 8 no longer works.
First you can set overlaid view controller's background colour as clear colour.
You can use presentViewController method to overlay new view controller.
This from apple docs
When presenting a view controller using the UIModalPresentationFullScreen style, UIKit normally removes the views of the underlying view controller after the transition animations finish. You can prevent the removal of those views by specifying the UIModalPresentationOverFullScreen style instead.
So you can set overlaid view controller's modalPresentationStyle to UIModalPresentationOverFullScreen
I also hope this may be help
When using one of the full-screen presentation styles, the view controller that initiates the presentation must itself cover the entire screen. If the presenting view controller does not cover the screen, UIKit walks up the view controller hierarchy until it finds one that does. If it can’t find an intermediate view controller that fills the screen, UIKit uses the root view controller of the window.
To solve this problem you just have to change the Alpha information of your View. To get this view on top of others, change the Transition Style of the ViewController.
FYI: The syntax is now:
childVC.modalPresentationStyle = UIModalPresentationStyle.OverFullScreen
I'm developing an app targeting iOS 7 and above. I'd like to present modally a view with a dim background that partially shows the previous view below. I've read several posts dealing with this scenario, and I did:
Created a view controller scene in storyboard and set a modal segue to navigate to it.
Set the Presentation value of that modal segue to Current Context.
Set the view controller's view background color to clear color.
Added a full-screen view above the parent view, with black color background and 50% opacity.
Transition to the modal view is default and animated. While the animation, I see the view being presented as semi-transparent, but once the transition animation ends and view finally occupies the full screen, the view becomes opaque black.
What I'm doing wrong? How could I solve this?
As #luk2302 said, when you present a view controller modally, iOS removes the view controllers underneath it from the view hierarchy so is nothing underneath it except the app window, which is black. Anyway, iOS 7 has a new modal presentation style, UIModalPresentationCustom, that forces iOS not to remove the views underneath the presented view controller. But you must provide your own transition delegate to handle the presentation and dismiss animations
Check this link how to implement custom transition delegate.