如何使用SWRevealViewController显示已resize的侧边栏?
我在IOS应用程序(通用)中使用SWRevealViewController。 我在iPhone和iPad上都有侧边栏但是我想显示侧边栏,它覆盖了90%的屏幕 – 我怎么能这样做?
打开SWRevealViewController.m
文件,然后获取_initDefaultProperties
方法。 在这种方法中,您可以获得侧屏尺寸和位置
- (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; }
只需要一个if语句来确定侧边栏的正确大小。 像这样的东西:
if(device == iPad) _rearViewRevealWidth = 600.0f; else if(device == iPhone) _rearViewRevealWidth = 260.0f;
打开SWRevealViewController.m
文件,然后获取_initDefaultProperties
方法。
- (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; .... }
你可以做这样的事情…当你有来自SWRevealViewController的子类…这个问题的call属性并设置你想要的…希望它帮助某人…
self.rightViewRevealWidth = [UIScreen mainScreen].bounds.size.width * 0.9;
- Xcode:如何暂时从Issue Navigator中隐藏黄色警告
- 在IOS上使用AVComposition混合两个audio文件
- UIAlertview委托方法不在子视图控制器中调用
- 如何启用Facebook像GameCenter的iOS 8?
- UITableView ContentInsets水平滚动内容
- 是可以改变一个UISearchBar占位符的alignment?
- 如何parsingiOS应用程序中的JSON
- 用普通CALayer显示图像或UIImage
- 如何在两个ViewController之间传递数据,其中第一个VC有两个tableViews,第二个tableViewselect的数据应该传递给第二个VC?