How do I fade/dim the background of my app while k

2019-09-02 01:19发布

问题:

This question already has an answer here:

  • iOS Dim background when a view is shown 4 answers

Take this Tweetbot 3 screenshot:

How do I present a view and fade out ALL the back views except the one in front to a dark colour?

回答1:

Create a full screen UIView with background color as [UIColor colorWithRed:0.f green:0.f blue:0.f alpha:0.5f]and add your custom view as subView of this new view and then based on your needs you can present this new UIView on top of your current screen which will look faded out except for main centric view.