Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to make the UIViewController semi transparent [duplicate]

I have a two UIViewControllers, and I am displaying the secondViewController modally over the firstViewController. My secondViewController contains a subview which is UIView with some buttons. Now what I want to do is, make the SecondViewController semi transparent so that my firstViewController is visible and only show the subview modally which is not transparent.

Reagards Ranjit

like image 771
Ranjit Avatar asked Oct 07 '22 04:10

Ranjit


1 Answers

when you present your view controller, view of previous controller is removed so if you set any alpha for your current controller's view, you will get UIWindow's background.

if you intend to play with the transparency, then instead of doing presentModalViewController, in first viewcontroller, [self.view addSubView:controller2.view]; and make controller2.view.alpha = 0.5;//whatever transparency level u want

like image 165
Saurabh Passolia Avatar answered Oct 13 '22 11:10

Saurabh Passolia