6

I am using SWRevealViewController in IOS app (universal). I'm getting sidebar in iPhone and iPad both but I want to show sidebar which covers 90% of screen - how can I?

Anbu.Karthik
  • 82,064
  • 23
  • 174
  • 143
Premal Khetani
  • 3,175
  • 1
  • 26
  • 58

4 Answers4

13

open the SWRevealViewController.m file and then u get the _initDefaultProperties Method. in this method you get the side screen size and position

- (void)_initDefaultProperties
{
_frontViewPosition = FrontViewPositionLeft;
_rearViewPosition = FrontViewPositionLeft;
_rightViewPosition = FrontViewPositionLeft;
_rearViewRevealWidth = 260.0f;      /// this is the method u change the side bar width
_rearViewRevealOverdraw = 60.0f;
_rearViewRevealDisplacement = 40.0f;
_rightViewRevealWidth = 260.0f;
_rightViewRevealOverdraw = 60.0f;
_rightViewRevealDisplacement = 40.0f;
_bounceBackOnOverdraw = YES;
_bounceBackOnLeftOverdraw = YES;
_stableDragOnOverdraw = NO;
_stableDragOnLeftOverdraw = NO;
_presentFrontViewHierarchically = NO;
_quickFlickVelocity = 250.0f;
_toggleAnimationDuration = 0.25;
_frontViewShadowRadius = 2.5f;
_frontViewShadowOffset = CGSizeMake(0.0f, 2.5f);
_frontViewShadowOpacity = 1.0f;
_userInteractionStore = YES;
_animationQueue = [NSMutableArray array];
_draggableBorderWidth = 0.0f;
}
Anbu.Karthik
  • 82,064
  • 23
  • 174
  • 143
2

Just have an if statement to determine the correct size of the sidebar. something like this:

if(device == iPad)
     _rearViewRevealWidth = 600.0f;
else if(device == iPhone)
     _rearViewRevealWidth = 260.0f;
G3t Lucky
  • 21
  • 1
1

open the SWRevealViewController.m file and then you get the _initDefaultProperties Method.

 - (void)_initDefaultProperties
{

 AppDelegate *appDelegate = (AppDelegate *)[UIApplication sharedApplication].delegate;

      float x=(appDelegate.windowWidth)*9/10; //windowWidth=self.window.bounds.size.width;
      float y=x-260;

    _frontViewPosition = FrontViewPositionLeft;
    _rearViewPosition = FrontViewPositionRightMost;
    _rightViewPosition = FrontViewPositionLeft;
    _rearViewRevealWidth = x;
    _rearViewRevealOverdraw = 60.0f+y;
    _rearViewRevealDisplacement = 40.0f+y;
....
}
Suraj Sukale
  • 1,778
  • 1
  • 12
  • 19
Betsy
  • 219
  • 3
  • 10
  • if you're using the SWRevealController pod, it might be better to define this value elsewhere instead of editing the pod code. In the controller that is the revealViewController's frontView, set the rearViewRevealWidth: if self.revealViewController() != nil { self.revealViewController().rearViewRevealWidth = self.view.frame.size.width * 0.80 } – mitrenegade Aug 27 '15 at 21:38
0

You can do something like this... When you have subclass from SWRevealViewController... call property for this problem and set as you want... Hope it's help someone...

self.rightViewRevealWidth = [UIScreen mainScreen].bounds.size.width * 0.9;
John
  • 1
  • 1