Push/Present a viewcontroller from right,the viewcontroller cover 3/4 part of previous viewcontroller

89 Views Asked by At

I want to do this:I push or present a viewcontroller called B, the previous viewcontroller called A, but B won't cover full screen, it's 3/4 width of screen's width,the left 1/4 width of A turns dark,when I tap this area,B can be dismissed,is this possible? Appreciate for your suggestions!

2

There are 2 best solutions below

0
On

Select the view controller in Storyboard. Goto Attributes Inspector -> Simulated Metrics -> Size -> freeform

Change the width of the B view controller to whatever you want.

1
On

Why don't you try out some open source libraries to achieve this. The best library that I have come across is SWRevealViewController

There is a TUTORIAL on AppCoda featuring this library. Check that out for more info.

FYI,

If you still prefer a DIY approach, take a look at this.