Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to show resized sidebar using SWRevealViewController?

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?

like image 826
Premal Khetani Avatar asked Aug 07 '14 06:08

Premal Khetani


2 Answers

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;
}
like image 58
Anbu.Karthik Avatar answered Sep 20 '22 14:09

Anbu.Karthik


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;
like image 30
G3t Lucky Avatar answered Sep 19 '22 14:09

G3t Lucky