CSRevealingViewController 0.3.0

CSRevealingViewController 0.3.0

测试已测试
语言语言 Obj-CObjective C
许可证 MIT
发布上次发布2014年12月

Josef Lange 维护。



CSRevealingViewController

一个自定义 ViewController,它嵌入了两个额外的 UIViewController 对象,将一个显示在另一个前面。顶层的 ViewController 可以被拖动到开发者指定的方向,以显示底层的 ViewController。

用法

用法相当简单。即将提供 IB 直接集成,但在此期间,这正是你在寻找的模式

将依赖添加到您的 Podfile

platform :ios
pod 'CSRevealingViewController'
...

运行 pod install 以安装依赖项。

在您的 storyboard 中,将根 ViewController 的自定义类设置为 CSRevealingViewController,并实例化您想要嵌入其中的 ViewControllers。确保为这两个提供您能记住的合理标识符。

然后在您的 AppDelegate 中

#import <CSRevealingViewController/CSRevealingViewController.h>

- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions {
    // Get the root ViewController, cast into what it really is. Also grab its storyboard, we'll need that.
    CSRevealingViewController *rVC = (CSRevealingViewController *)self.window.rootViewController;
    UIStoryboard *mainStoryboard = rVC.storyboard;

    // Set up the revealing behavior.
    rVC.overhang = 50.0f;   // "Overhang" that the top VC shows when revealing the bottom VC.
    rVC.direction = CSRevealingSwipeDirectionUp;    // Which direction you want to swipe to reveal.
    rVC.shouldRespondToEdgeTap = YES;   // Do you want to respond to tapping the "overhang" edge of the top VC to make it reveal?

    // Retrieve and set the top and bottom ViewControllers.
    UIViewController *back = [mainStoryboard instantiateViewControllerWithIdentifier:@"BackRootVC"];
    UIViewController *front = [mainStoryboard instantiateViewControllerWithIdentifier:@"FrontRootVC"];
    rVC.backViewController = back;
    rVC.frontViewController = front;

    return YES;
}