RESideMenu-onlyLeft 4.0.7

RESideMenu-onlyLeft 4.0.7

测试已测试
语言语言 Obj-CObjective C
许可 MIT
发布最新发布2014年12月

Jongsu Park维护。



  • Jongsu Park

RESideMenu

受 Dribbble 图像启发的 iOS 7/8 风格侧边菜单,具有视差效果(第一第二个)。

自从版本 4.0 起,您可以在内容视图控制器的左右两边添加菜单视图控制器。

RESideMenu Screenshot RESideMenu Screenshot

要求

  • Xcode 5 或更高版本
  • Apple LLVM 编译器
  • iOS 6.0 或更高版本
  • ARC

展示

在 Xcode 中构建并运行 RESideMenuExample 项目以查看 RESideMenu 的实际应用。对于故事板集成展示,构建并运行 RESideMenuStoryboardsExample

安装

手动安装

您只需将 RESideMenu 文件拖放到您的项目中,并在将使用它的类的顶部添加 #include "RESideMenu.h"

示例用法

在您的 AppDelegate 的 - (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions 中创建视图控制器并将内容视图控制器和菜单视图控制器分配给它。

// Create content and menu controllers
//
DEMONavigationController *navigationController = [[DEMONavigationController alloc] initWithRootViewController:[[DEMOHomeViewController alloc] init]];
DEMOLeftMenuViewController *leftMenuViewController = [[DEMOLeftMenuViewController alloc] init];
DEMORightMenuViewController *rightMenuViewController = [[DEMORightMenuViewController alloc] init];

// Create side menu controller
//
RESideMenu *sideMenuViewController = [[RESideMenu alloc] initWithContentViewController:navigationController
                                                                leftMenuViewController:leftMenuViewController
                                                               rightMenuViewController:rightMenuViewController];
sideMenuViewController.backgroundImage = [UIImage imageNamed:@"Stars"];

// Make it a root controller
//
self.window.rootViewController = sideMenuViewController;

显示菜单视图控制器

[self.sideMenuViewController presentLeftMenuViewController];

或者

[self.sideMenuViewController presentRightMenuViewController];

切换内容视图控制器

#import <RESideMenu/RESideMenu.h>

....

[self.sideMenuViewController setContentViewController:viewController animated:YES];
[self.sideMenuViewController hideMenuViewController];

故事板示例

  1. 创建 RESideMenu 的子类。在这个例子中,我们称它为 DEMORootViewController
  2. 在 Storyboard 中,将根视图的所有者指定为 DEMORootViewController
  3. 确保在 DEMORootViewController.h 中包含了 #import "RESideMenu.h"
  4. 在 Storyboard 中添加更多视图控制器,并给它们分配标识符 "leftMenuViewController"、"rightMenuViewController" 和 "contentViewController"。请注意,在新的 XCode 中,标识符被称为 "Storyboard ID",可在 Identity 检查器中找到。
  5. DEMORootViewController.m 中添加一个名为 awakeFromNib 的方法,代码如下
- (void)awakeFromNib
{
    self.contentViewController = [self.storyboard instantiateViewControllerWithIdentifier:@"contentViewController"];
    self.leftMenuViewController = [self.storyboard instantiateViewControllerWithIdentifier:@"leftMenuController"];
    self.rightMenuViewController = [self.storyboard instantiateViewControllerWithIdentifier:@"rightMenuController"];
}

定制

您可以定制以下响应式菜单的属性

@property (assign, readwrite, nonatomic) NSTimeInterval animationDuration;
@property (strong, readwrite, nonatomic) UIImage *backgroundImage;
@property (assign, readwrite, nonatomic) BOOL panGestureEnabled;
@property (assign, readwrite, nonatomic) BOOL panFromEdge;
@property (assign, readwrite, nonatomic) NSUInteger panMinimumOpenThreshold;
@property (assign, readwrite, nonatomic) BOOL interactivePopGestureRecognizerEnabled;
@property (assign, readwrite, nonatomic) BOOL scaleContentView;
@property (assign, readwrite, nonatomic) BOOL scaleBackgroundImageView;
@property (assign, readwrite, nonatomic) BOOL scaleMenuView;
@property (assign, readwrite, nonatomic) BOOL contentViewShadowEnabled;
@property (assign, readwrite, nonatomic) UIColor *contentViewShadowColor;
@property (assign, readwrite, nonatomic) CGSize contentViewShadowOffset;
@property (assign, readwrite, nonatomic) CGFloat contentViewShadowOpacity;
@property (assign, readwrite, nonatomic) CGFloat contentViewShadowRadius;
@property (assign, readwrite, nonatomic) CGFloat contentViewScaleValue;
@property (assign, readwrite, nonatomic) CGFloat contentViewInLandscapeOffsetCenterX;
@property (assign, readwrite, nonatomic) CGFloat contentViewInPortraitOffsetCenterX;
@property (assign, readwrite, nonatomic) CGFloat parallaxMenuMinimumRelativeValue;
@property (assign, readwrite, nonatomic) CGFloat parallaxMenuMaximumRelativeValue;
@property (assign, readwrite, nonatomic) CGFloat parallaxContentMinimumRelativeValue;
@property (assign, readwrite, nonatomic) CGFloat parallaxContentMaximumRelativeValue;
@property (assign, readwrite, nonatomic) CGAffineTransform menuViewControllerTransformation;
@property (assign, readwrite, nonatomic) BOOL parallaxEnabled;
@property (assign, readwrite, nonatomic) BOOL bouncesHorizontally;
@property (assign, readwrite, nonatomic) UIStatusBarStyle menuPreferredStatusBarStyle;
@property (assign, readwrite, nonatomic) BOOL menuPrefersStatusBarHidden;

如果您设置了背景图,别忘了将菜单视图控制器的背景色设置为透明颜色。

您可以实现 RESideMenuDelegate 协议以接收以下消息

- (void)sideMenu:(RESideMenu *)sideMenu didRecognizePanGesture:(UIPanGestureRecognizer *)recognizer;
- (void)sideMenu:(RESideMenu *)sideMenu willShowMenuViewController:(UIViewController *)menuViewController;
- (void)sideMenu:(RESideMenu *)sideMenu didShowMenuViewController:(UIViewController *)menuViewController;
- (void)sideMenu:(RESideMenu *)sideMenu willHideMenuViewController:(UIViewController *)menuViewController;
- (void)sideMenu:(RESideMenu *)sideMenu didHideMenuViewController:(UIViewController *)menuViewController;

联系

罗马·叶菲莫夫

许可证

RESideMenu 适用于 MIT 许可证。

版权所有© 2013 罗马·叶菲莫夫。

特此无条件许可,任何人获得本软件及其相关文档副本(以下称为“软件”),可不受限制地处理软件,包括使用、复制、修改、合并、发布、分发、再许可和/或出售软件的副本,并允许向得到软件的人授权进行此类操作,但受下述条件约束

上述版权声明和本授权声明应包含在软件的所有副本或主要部分中。

本软件按“原样”提供,不提供任何形式的保证,明示或暗示,包括但不限于适销性、针对特定目的而适用的保证和侵权性。在任何情况下,作者或版权所有者不应对任何赔偿、损害或其它责任负责,无论源于合同、侵权或其他行为,即使与软件或软件的使用或其它操作有关。