Code Monkey home page Code Monkey logo

viewdeck's Introduction

Logo

CocoaPods Version GitHub Tag GitHub Release

Semantic Versioning License Platform

IIViewDeckController

ViewDeck is a framework to manage side menus of all kinds. It supports left and right menus and manages the presentation of the side menus both programmatically and through user gestures.

The heart of ViewDeck is IIViewDeckController, which is a container view controller. You can then assign your center view controller to it as well as side view controllers. IIViewDeckController makes sure your content view controllers are added to the view controller hierarchy their views are added to the view hierarchy when needed.

ViewDeck does not provide any kind of configurable menus. It is up to you to assign your center and side view controllers to ViewDeck so that ViewDeck can then take over and present them as necessary.

IIViewDeckController supports both a left and a right side view controller and of course you can also only use one side. You can open and close the side views programmatically, e.g. through a tap of a button. By default IIViewDeckController also listens to swipe gestures by the user and interactively opens the side views accordingly.

Of course ViewDeck plays nice with existing container view controllers such as UINavigationController or UITabBarController.

Requirements

  • Base SDK: iOS 10
  • Deployment Target: iOS 8.0 or greater
  • Xcode 8.x

Try it out

The easiest way to try out ViewDeck is using cocoapods. By running pod try ViewDeck an Xcode project will be created that runs the demo app. Of course you can also simply check out the repository and run the example app there. Just open the ViewDeckExample.xcworkspace file in the Example folder and run it.

Demo video & Screenshots

You're probably curious how it looks. Here's some shots from the example app:

ViewDeck on iPhone

ViewDeck on iPad

See the controller in action:

IMAGE ALT TEXT HERE

Installation

CocoaPods

Integrating ViewDeck via CocoaPods is the easiest and fastest way to get started. Simply add the following line into your Podfile:

pod 'ViewDeck'

This will get you the latest ViewDeck version every time you type pod update in your terminal.

If you prefer a more conservative integration, you can also go with the following line:

pod 'ViewDeck', '~> 3.0'

This will update all 3.x version if you execute pod update but it will not update to version 4.x once this is released. ViewDeck follows semantic versioning, meaning that within a given major version (currently 3.x) there will be no breaking changes. You may see deprecations appear on methods that are likely to go away in the next major release but until then they will continue to work.

After integrating ViewDeck via CocoaPods, all you need to do is #import <ViewDeck/ViewDeck.h> in a class where you want to use ViewDeck.

Manually

  • Download the latest ViewDeck release from the release section
  • Move the ViewDeck.framework into your Xcode project

Getting started

ViewDeck supports a left and a right side view controller. Each of these can be nil (if it is, no panning or opening to that side will work and gesture recognizers for this side are deactivated). The base class for everything is IIViewDeckController. A typical view deck configuration looks like this:

- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions {
	MyCenterViewController *centerViewController = [MyCenterViewController new];
	UINavigationController *navigationController = [[UINavigationController alloc] initWithRootViewController:centerViewController];
	
	MySideViewController *sideViewController = [MySideViewController new];
	UINavigationController *sideNavigationController = [[UINavigationController alloc] initWithRootViewController:sideViewController];
	
	IIViewDeckController *viewDeckController = [[IIViewDeckController alloc] initWithCenterViewController:navigationController rightViewController:sideNavigationController];
	
	self.window.rootViewController = viewDeckController;
	[self.window makeKeyAndVisible];
	return YES;
}

Switching controllers

You can also switch view controllers in mid flight. Just assign a view controller to the appropriate property and the view deck controller will do the rest:

// prepare view controllers
UIViewController* newController = [[UIViewController alloc] init];
self.viewDeckController.rightController = newController;

You can also use this to remove a side controller by just setting it to nil.

Accessing the view deck controller

Like UINavigationViewController the IIViewDeckController assigns itself to its childviews. You can use the viewDeckController property to get access to the enclosing view deck controller:

#import <ViewDeck/ViewDeck.h>
...
[self.viewDeckController openSide:IIViewDeckSideRight animated:YES];

If the controller is not enclosed by IIViewDeckController, this property returns nil.

Controlling the side’s size

ViewDeck tries to embed into UIKit as nice as possible and therefore leverages a lot of already existing hooks. In order to control a side view controller’s size on the screen, you simply set its preferredContentSize. ViewDeck will respect the width of this size while making sure the height is always the height of the view deck controller itself.

Customizing the side’s appearance and animations

You can customize a lot about how ViewDeck presents side view controllers. Check out the documentation on -[IIViewDeckController animatorForTransitionWithContext:] and IIViewDeckTransitionAnimator.

Special Thanks

Special thanks to Tom Adriaenssen who started this project and created a very great framework that helps so many developers. Sadly he can no longer maintain this framework. Check out his blog if you want to find out why, it’s actually pretty good news, so congratulations, Tom! :)

Very special thanks to the awesome Samo Korosec for designing the beautiful logo for ViewDeck! He is a very great designer and a very funny colleague. If you need cool app design work done, check him out!

Credits

I would appreciate it to mention the use of this code somewhere if you use it in an app. On a website, in an about page, in the app itself, whatever. Or let me know by email or through github. It's nice to know where one's code is used. Also, if you have a cool app that uses view deck, and you want it to be listed here, let me know!

License

IIViewDeckController published under the MIT license:

Copyright (C) 2011-2015, ViewDeck

Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

viewdeck's People

Contributors

a2 avatar abbottmg avatar abiaad avatar af-fmu avatar barksten avatar cbpowell avatar chourobin avatar csgulley avatar dflems avatar dmpatierno avatar drewmccormack avatar elegia avatar fousa avatar groue avatar icarambaa avatar inferis avatar iv-mexx avatar kreeger avatar michaelochs avatar molescat avatar mpowell avatar neilkimmett avatar nirgolan avatar orj avatar peoplematterkevin avatar phedlund avatar richerd avatar robby avatar spenrose avatar turtlesoupy avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

viewdeck's Issues

Please add semantic version tags.

I’ve recently added ViewDeck to the CocoaPods package manager repo.

CocoaPods is a tool for managing dependencies for OSX and iOS Xcode projects and provides a central repository for iOS/OSX libraries. This makes adding libraries to a project and updating them extremely easy and it will help users to resolve dependencies of the libraries they use.

However, ViewDeck doesn't have version tags. I’ve added the current HEAD as version 0.0.1, but a version tag will make dependency resolution much easier.

Semantic version tags (instead of plain commit hashes/revisions) allow for resolution of cross-dependencies.

No way to disable swiping gestures (force button taps for left/right reveals)

Really love ViewDeck - great work!

I have a feature question/request. I can't seem to find a way to disable the swiping gestures that can be used to reveal the side panels. I want to use conflicting gestures to navigate content. For example, when I swipe right it reveals the left view while at the same time executing my gesture recognizer code. Is this a feature I missed? What would you suggest?

iPad?

Hi,

Just wondering why the examples/the view deck doest render correctly on the iPad?

viewWillAppear not being called

In my app, when I change the centre view controller the above method is not being called and I can't work out why. I've looked at all your examples, when the tab bar one in your development branch and they all call the method and I can't see why mine doesn't!

It's probably a really stupid issue with an extremely simple answer but the code I'm using to change the center view controller is:

- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath
{
    if (indexPath.row == COMBINED) {
        [self.viewDeckController closeLeftViewBouncing:^(IIViewDeckController *controller) {
            CombinedNewsViewController *newsCombinedList = [[CombinedNewsViewController alloc] initWithNibName:@"CombinedNewsViewController" bundle:nil];
            UINavigationController* navController = [[UINavigationController alloc] initWithRootViewController:newsCombinedList];
            self.viewDeckController.centerController = navController;
        }];
    } else if (indexPath.row == SOURCES) {
        NewsFeedListViewController *newsFeedList = [[NewsFeedListViewController alloc] initWithNibName:@"NewsFeedListViewController" bundle:nil];
        [self.viewDeckController closeLeftViewBouncing:^(IIViewDeckController *controller) {
            UINavigationController* navController = [[UINavigationController alloc] initWithRootViewController:newsFeedList];
            self.viewDeckController.centerController = navController;
        }];
    }
}

If it makes any difference, viewDidLoad is called! However I also need viewWillAppear!

CenterController ViewDidLoad called twice.

Hi there,

First thing first: my compliments: very good job indeed!

I found a bug (or at least I think is not the expected behaviour.

When I start the app, the ViewDidLoad method of the centerViewController gets called twice.

Here's how I setup the ViewControllers in the App Delegate:

    self.window = [[UIWindow alloc] initWithFrame:[[UIScreen mainScreen] bounds]];
    // Override point for customization after application launch.
    UIViewController *centerViewController = [[ViewController alloc] initWithNibName:@"ViewController" bundle:nil];
    UIViewController *sideViewController = [[ViewController alloc] initWithNibName:@"SideViewController" bundle:nil];
    IIViewDeckController *deckController = [[IIViewDeckController alloc] initWithCenterViewController:centerViewController rightViewController:sideViewController];

    self.window.rootViewController = deckController;
    [self.window makeKeyAndVisible];
    return YES;

UITextView repainting issue when reopening a view

I've integrated ViewDeck - very cool experience - and for the most part I have been able to work around integrating other projects that assume as standard IOS UIKit implementation.

One issue that baffles me, however, is a repainting issue with UITextView. It only happens when I use ViewDeck to own the UIViewController containing the UITextView.

On launch of the app, I display a UIViewController that contains a UITextView with content in it. All content is shown properly. This UIViewController is the "center" or "main panel".

Just like Facebook's app does, I have a trigram in the upper left nav bar, and the user can slide the center panel away to see a menu in a UITableView. All good here too.

However, when the user reselects the menu item to display the original center panel, the UITextView:

  • contains all of the content
  • however it does not display it all, it only displays the text on the left 1/3 of the panel.
  • the remaining text is not painted visually on the screen, but it exists inside the UITextView.

This issue only happens when I'm in the ViewDeck model. I'm a fairly experienced developer and have tested all sorts of things, including repainting the UITextView in a delayed performSelector after all the animation for the ViewDeck is completed. No luck.

The only thing that repaints the UITextView is when the user rotates the screen.

Any ideas what could be going on?

iOS 4 already supported

In the description in README, you said:

The library currently requires ARC. This means you can use it only for iOS5 projects.

However, this is not true because ARC is actually iOS4-compatible.

To verify, I just modified the deployment target setting, and it went well on both my device, and simulator.

Good work! :)

the animation's options is wrong when closeLeftView

  • (void)closeLeftViewAnimated:(BOOL)animated completion:(void (^)(IIViewDeckController *))completed {
    [self closeLeftViewAnimated:animated options:UIViewAnimationOptionCurveEaseInOut completion:completed];
    }

UIViewAnimationOptionCurveEaseInOut should be UIViewAnimationOptionCurveEaseOut

if using UIViewAnimationOptionCurveEaseInOut, the animation will slow to normal, the animation effect is not OK

the method closing right view or opening right view should be check too.

Tiny gap on top

Hi,

Hope I'm not opening an useless issue due to my small knowledge in iOS development, but I'll try.

Everything works how I expect and helps me a lot. Just a little thing I can't figure out what I'm doing wrong, is when I change centerController from the leftController :

- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath
{
    [tableView deselectRowAtIndexPath:indexPath animated:YES];
    [self.viewDeckController closeLeftViewBouncing:^(IIViewDeckController *controller)
    {
        self.viewDeckController.centerController = [[UINavigationController alloc] initWithRootViewController:[self.menuControllers objectAtIndex:indexPath.row]];
    }];
}

Where menuControllers is an array of UIViewControllers (for the ease of registerting new items in my menu)

I got this small gap on top of my view when it come to change.

The gap

Do you have any idea where this come from, and tell me if I did something wrong by updating the centerController this way ?

Thanks for helping, this is for school project purpose :)

setTitle: causes EXC_BAD_ACCESS on iPhone

I am using ViewDeck with a UINavigationController (i am doing custom stuff with the backgroundView and using the titleView to display a UIImageView, perhaps this has something to do with it?). The setTitle: method fires due to the KVO telling it to (haven't dug in to why), setTitle: tries to set the title of center controller to nil (which already has a title of nil) and EXC_BAD_ACCESS occurs.

This does not occur on iPad with the same code, on iPad I am not setting a left bar button item, whereas I am in the iPhone. I am also using a MGSplitViewController as the root view controller for iPad, on iPhone the viewDeck controller is the root view controller.

I have locally changed my setTitle: method to this and it resolves it:

- (void)setTitle:(NSString *)title {
    if ([self.centerController isKindOfClass:[UINavigationController class]]) {
        UINavigationController *centerController = (UINavigationController *)self.centerController;
        if (!centerController.title && !title) return;
        }
    [super setTitle:title];
    self.centerController.title = title;
}

Memory leak in WrapController's loadView

The following line of code in WrapController's loadView has a memory leak:

self.view = [[UIView alloc] initWithFrame:II_CGRectOffsetTopAndShrink(self.wrappedController.view.frame, [self statusBarHeight])];

due to the fact that self.view is declared as retain in UiViewController.h. The line should be changed to the following, I believe:

self.view = [[[UIView alloc] initWithFrame:II_CGRectOffsetTopAndShrink(self.wrappedController.view.frame, [self statusBarHeight])] autorelease];

Navigationbar panning not working

I tried setting the panningMode property to IIViewDeckNavigationBarPanning in the ViewDeckExample project, but it does not work. Default panning (touch anywhere) works. This is with latest XCode 4.3 beta and simulator 5.1

Storyboard feature tutorial

Can you make a tutorial with storyboard about how to make the features example app? Looking at the source code doesn't seem to work properly for new projects that use storyboard instead of xibs.

SIGABRT when selection a cell in LeftViewController

I've got an error in LeftViewController, line 151:
-[LeftViewController topViewController]: unrecognized selector sent to instance 0x6b62080
*** Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '-[LeftViewController topViewController]: unrecognized selector sent to instance 0x6b62080'

It happens, when you are in "Swipe Left & Center"-Mod, wipe the fullscreen tableView to the right, so the TableView with the toolbar appears under it, and then select any cell of the fullscreen tableView.

Tapping the status bar to scroll a table view in the center view to the top doesn't work

I must admit I implemented a controller like yours a couple of weeks ago, and had this issue too, and didn't quite discover a way to accomplish this. In the end I decided to stop developing my controller and use yours as it was less buggy and more complete.
But the question is: have you thought of this?
I think tapping the status bar is a pretty usefull feature in iOS, and it's annoying not to be able to do it :S

What I've been wondering is..... why does it work when it's a table view (or scroll view) inside a UINav controller for instance, but not when it's insice a custom controller? what's the difference with that?

Let me know if you find out what could be done about this...

Thanks a lot!

Abuse of UIViewControllers leads to subtle, pesky bugs

ViewDeck is an excellent example of a class that does what's described here:
http://blog.carbonfive.com/2011/03/09/abusing-uiviewcontrollers/

Consequently, there are subtle bugs that are hard to work around. Two examples:

  1. It doesn't handle view controllers properly that hide the phone's status bar.

  2. It allows view controllers on the navigation stack to rotate even when they shouldn't. I can reproduce this by pushing several view controllers that only display in portrait mode onto the navigation stack, followed by one that allows any orientation. The navigation controller is the view deck's center controller. Rotating the device to landscape mode with the one that allows any orientation works fine, but when the stack is popped to the controller that doesn't support anything but portrait mode, it is left in landscape mode and the UIViewController methods having to do with rotation are never called.

My workaround was to only allow the ViewDeck controller to be the main window's view controller when the left or right view is partially exposed, then to remove the ViewDeck controller and directly assign the left or right view to the window when fully open or closed. This will not work for all applications of the ViewDeck, but was sufficient for my particular application.

Center view gets a tap when not dragged completely

How to reproduce:

  • Start dragging the center view to the right (this is my case) pointing your finger on something that, when tapped, pushes a view controller onto the nav stack.
  • Don't drag it enough so that when you release your finger, the center view goes back and closes the left view
  • The center view gets the tap and it pushes a view.

I have no idea how this would be solved, but I think it would be a nice improvement :)

Thanks!!

shouldAutorotateToInterfaceOrientation doesn't honor modalViewController?

If you bring up the camera in ViewDeckExample and rotate, the camera view gets all messed up.

I think this is because IIViewDeckController shouldAutoroateToInterfaceOrientation doesn't honor whether or not a modal view controller on the center controller wants to allow rotation.

This patch fixes it, and stops the camera (UIImagePickerController) from rotating around and getting all confused.

Also fixes same issue I ran into in my app.

However, there is definitely a different behavior when running under IIViewDeckController and a standard controller for my app and modal view controllers (even with this fix):

A. with IIViewDeckController and this patch:

  1. start out in portrait, and bring up a modal view that doesn't allow rotation
  2. rotate to landcape, modal view doesn't rotate as expected
  3. close modal view, original is still in portrait (need to rotate back to portrait

B. same app without IIViewDeckController

  1. start out in portrait, and bring up a modal view that doesn't allow rotation
  2. rotate to landcape, modal view doesn't rotate as expected
  3. close modal view, original is in landscape

minor issue of course, but does make me wonder if there is a better fix.

Also wondering what happens when there is another modal view controller on top of the model view controller, etc. i.e., should we find the topmost modalViewController and ask it if we are allowed to rotate).

    if (self.centerController) {
-        // let the center controller handle the rotation behavior
-        BOOL should = [self.centerController shouldAutorotateToInterfaceOrientation:interfaceOrientation];
+        BOOL should;
+        if (self.centerController.modalViewController) {
+            // let the center controller modalViewController handle the rotation behavior
+            should = [self.centerController.modalViewController shouldAutorotateToInterfaceOrientation:interfaceOrientation];
+        } else {
+            // let the center controller handle the rotation behavior
+            should = [self.centerController shouldAutorotateToInterfaceOrientation:interfaceOrientation];
+        }
          return should;
      }

viewDeckController property returns "nil"

Sorry for my rudimentary questions.

I ran the ViewDeckExample, the viewDeckController property returns "nil" on the left/rightViewConttoller.
So it didn't work like the demo(http://vimeo.com/34538429), didSelectRowAtIndexpath on leftViewContoller.

Please tell me what should I do anything.

centerhiddenInteractivity

If I set the deckController.centerhiddenInteractivity to IIViewDeckCenterHiddenNotUserInteractiveWithTapToClose
then the center view gets stuck a few pixels from the left while panning to open the left view. when i pan again it finally opens.

ARC enabled
tested on iPhone 4s on iOS 5.0.1

CenterView Does Not Respond To Rotation Events

When a view is placed in the center view and then the device is rotated.

The following method is never called.

  • (void)willAnimateRotationToInterfaceOrientation:(UIInterfaceOrientation)toInterfaceOrientation duration:(NSTimeInterval)duration{

}

Tab bar example & rightBarButtonItem

Hi

Again, this is probably a simple question so I apoligise up front.

I'm using the tabbed example in your dev branch and on my viewController1 I have a rightBarButtonItem, however, when I switch to my viewController2 I can't seem to add a different rightBarButtonItem, it always has the same one from viewController1.

Is there a way of changing the bar buttom items?

Leaking the view

It's not really important as this controller lives along with the app, but it can be if you get a memory warning and it gets deallocated. You seem to be leaking the main view:

  • (void)loadView
    {
    _viewAppeared = NO;
    self.view = [[UIView alloc] init]; // + 1 + 1
    self.centerView = [[UIView alloc] init]; // +1 + 1
    [self.view addSubview:self.centerView];

    self.originalShadowRadius = 0;
    self.originalShadowOpacity = 0;
    self.originalShadowColor = nil;
    self.originalShadowOffset = CGSizeZero;
    self.originalShadowPath = nil;
    }

Hope that helps :)

issue when swapping out centerController with closeLeftViewBouncing

I'm using closeLeftViewBouncing with a completion block that reassigns centerController while the center is offscreen, and I noticed that the newly centerController view actually starts out 20 pixels higher it should, and animates down as it slides back to the left.

this is very noticeable under the simulator if you turn on slow animations.

Also noticeable on the phone itself, as it makes the animation feel jerky/jumpy.

I'm switching between 3-4 different UINavigationControllers.

modal view controller not dismissing

looks like a recent changed changed the behavior of presentModalViewController to use viewDeckController if set, but doesn't also do the same for dismissModalViewControllerAnimated.

I have code that does:

[self presentModalViewController:navCon animated:YES];

and then later calls:

 [self dismissModalViewControllerAnimated:YES];

which no longer dismisses the modal view controller, since it was actually presented on viewDeckController.

If the overridden presentMVC* uses viewDeckController, then dismissMVC* must also do the same.

hidesBottomBarWhenPushed not working

When using the following code, the UITabBarController that I'm using is not hidden:

self.hidesBottomBarWhenPushed = YES;
[self.navigationController pushViewController:nextViewController animated:YES];
self.hidesBottomBarWhenPushed = NO;

If I create the UITabBarcontroller without IIViewDeckController in my app delegate then the tab bar is hidden.

I create by UITabBarController by using the following code. It's just one tab, there are actually more:

//ViewDeck Setup
NewsNavigationMenuViewController *menuController = [[NewsNavigationMenuViewController alloc] init];
CombinedNewsViewController *combinedNews = [[CombinedNewsViewController alloc] init];
UINavigationController *navigationController = [[UINavigationController alloc] initWithRootViewController:combinedNews];
navigationController.navigationController.navigationBar.tintColor = [UIColor blackColor];
IIViewDeckController *revealController = [[IIViewDeckController alloc] initWithCenterViewController:navigationController leftViewController:menuController rightViewController:nil];
revealController.title = @"News";

//create an array of views that will be passed to our tabbar
NSArray *viewsArray = [NSArray arrayWithObjects:revealController, nil];

//Now create our tab bar controller
TabBarController *tabBarController = [[TabBarController alloc] init];
//then tell the tabbarcontroller to use our array of views
[tabBarController setViewControllers:viewsArray];
//then the last step is to add the our tabbarcontroller as subview of the window
self.window.rootViewController = tabBarController;

[window makeKeyAndVisible];

Orientation problems

The problem occurs in both Sizable Example and Tabbed Example (#define TABBAR_ENABLED NO), the views become messy on orientation changed

should panning be disabled when keyboard is up?

I'm running with panningMode set to IIViewDeckNavigationBarPanning, and when I am in a screen with the keyboard up, it is possible to pan over to the left view.

The keyboard stays where it is though, and the center view slides to the right, which is definitely confusing.

Kinda feels like it might be a good idea to disable panning while keyboard is up. Maybe an option where IIViewDeckController listens for keyboard show/hide notifications and disables panning while keyboard is up?

Could it be used in combination with the famous TTNavigator from Three20 ?

Hey.
I'm trying to figure out if this nice component could be used in conjunction with the TTNavigator component of Three20.

I tried to set up root controller of the window to a viewController , in which I actually use the TTNavigator.

self.leftMenuController = [[LeftMenuController alloc] initWithNibName:@"LeftMenuController" bundle:nil];
self.rightMenuController = [[RightMenuController alloc] initWithNibName:@"RightMenuController" bundle:nil];
self.viewController = [[ViewController alloc] initWithNibName:@"ViewController" bundle:nil];

self.deckController = [[IIViewDeckController alloc] initWithCenterViewController:self.viewController leftViewController:self.leftMenuController rightViewController:self.rightMenuController];

self.window.rootViewController = self.deckController;

/**** and in the ViewController.m *******/

navigator = [TTNavigator navigator];
navigator.window = [[UIApplication sharedApplication] delegate].window;

map = navigator.URLMap;

[map from:@"tt://view2" toViewController:[TestView2 class]];

=>>The new controller TestView2 is being pushed but seems to replace the deckController since I can't use my left and right menus anymore. I am trying to find a way to combine both components so that the side menus are reachable anytime.

Compile with GCC

Currently the library will only compile with LLVM 2.1+

I know this is a longshot, but have you looked at or thought about allowing for compiling with GCC 4.2?

ViewDeck content is not updating during animation

Hi guys,
Thank you for this wonderful class.
I've tried to use it in an app of mine and I've encountered a strange behavior.

My hierarchy is: UIWindow > Tabbar Controller > View Controllers (view controller 0 is IIViewDeckController with my view controller set as center).

I've tried to animate a sort of fullscreen mode changing tabbar frame with the code below.
Without IIViewDeckController as container of my view everything is ok:
http://dl.dropbox.com/u/103260/ok.mov

When I try with IIViewDeckController as view controllers #0 of my tabbar seems the size is not animated (or layout is not updated?). The size still remain it...until I try to move, then the new size is applied (or view content is refreshed).
That's a demo:
http://dl.dropbox.com/u/103260/no.mov

PS. Note the shadow below my view (at the middle of the screen).

Any idea? Seems IIViewDeckController cannot respond to layoutSubviews or something like this when I try to animate frame of it's parent (the tabbar controller).

Does not call delegate methods when center view is dragged back to the edge and released

One example is a scenario with a left controller and a center controller, and the interactivity set to IIViewDeckCenterHiddenNotUserInteractiveWithTapToClose. Open the left controller, then slowly drag the center one back, not releasing until it is at the left edge. The code in "panned" will call showCenterView:YES, but the two cases will not test positive, since once the center dragging is complete the leftController.view.hidden is YES, so closeLeftViewAnimated is never called (and even if it was it wouldn't work since it is already closed) and the delegate methods are never called, so the delegate never receives viewDeckControllerDidCloseLeftView.

Protocol methods should be marked as @optional

First of all: GREAT, AMAZING, OUTSTANDING JOB you did with IIViewDeckController, my congratulations :)
I'm using it in my next app ;)

I implemented it today, and have a few more details to comment which I'll add over here when I have a spare minute. For now let me just add that the delegate should set all the methods as @optional, to quite the compiler warnings, since as I see you're checking if the delegate implements them anyway :)

Thanks a lot! Keep up the great work! :)

View hierarchy shifted when rotating while in fullscreen mode

Starting in portrait rotation:

  1. Push/present a view that hides the status bar and enters full screen mode
  2. Allow the view to be rotated
  3. Pop/Dismiss that view
  4. The center view initially appears unaffected, the left and right views are shifted up vertically the height of the status bar (underneath it)
  5. rotate the app with the centerview in either 3 positions
  6. the center view will now be shifted down the height of the status bar, the side views no appear normal
    Starting in landscape rotation
  7. most of the views get re-sized unreadable/unknown sizes and locations

This can be easily reproduced by added a simple viewcontroller to the test project and in it's viewwillappear and viewwilldissapear hide and show the status bar. I just re-used the camera button to hide/show the testview.

custom panningMode

My centerVC is a storyboard , and the firstVC of the storyboard is a navigation controller.
At first I edited addPanner and removePanner to fit that.. but:
I think that it could be nice if there was a UIView property that attaches the gesture recognizer (could be a tab bar / navigation bar or even a custom view).

The code is pretty simple (sorry , i'm fresh on gituhb , don't know how to "pull"/"fork"/etc. to do it myself) :
in .h file :

typedef enum {
    IIViewDeckNoPanning,              // no panning allowed
  ..
  ..
    IIViewDeckCustomPanning
} IIViewDeckPanningMode;

//ADD:
@property (nonatomic,retain) UIView* panningView;

in .m file :

- (void)addPanner {
    switch (_panningMode) {
        case IIViewDeckNoPanning: 
            break;
     ...
//ADD:  
      case IIViewDeckCustomPanning:
            self.panner = [[UIPanGestureRecognizer alloc] initWithTarget:self action:@selector(panned:)];
            self.panner.delegate = self;
            [self.panningView addGestureRecognizer:self.panner];
            break;
    }
}


- (void)removePanner {
//ADD : 
    if (_panningView) [self.panningView removeGestureRecognizer:self.panner];

}

Please tell me if you like it , I have a working version.

Status bar taps do not work

Tapping status bar does not scroll table view to the top when using navigation controller as central, left or right view controller.

Support for iOS 5 view containment API

This looks awesome. Especially since I'm currently working on my own solution and you'rs offers more options and a pretty clean API. One thing I'm missing is iOS 5's containment API which would make the whole thing less hacky and would remove the need for forwarding view controller methods.

Integration with iAd?

Hi,
I have an iAd in the center view controller. When the iAd activates then dismisses, the center controller is blank. How would I properly integrate iAd with this library? Thanks.

Resign first responder on left view open

I don't know if this should be a "feature" added to the ViewDeck class, or it should be something that we took care of, but in any case I think it's worth mentioning, cause it's an interesting issue which I can't really find a solution for.

Imagine this case: the center view controller has a UITextView for instance, and it opens the keyboard when the user taps on it and it becomes first responder. If I drag the view to show the left menu, the keyboard hides the whole screen. Can you think of ANY way to make whoever the first responder is resign as first responder when the menu is going to be shown?

Thanks in advance :) (and good job btw with the latest updates!)

view is empty when pushed by nav controller on ios 4.3

I have a app consisting of a tabcontroller and several nav controllers...

In a table view (contained in a nav controller) I have the following code;

WebViewController web = [[KPMGWebViewController alloc]init];
web.article = [APPDEL.datamodel.toc objectAtIndex:indexPath.row];
IIViewDeckController
deckController = [[IIViewDeckController alloc] initWithCenterViewController:web leftViewController:nil rightViewController:nil];
deckController.navigationControllerBehavior= IIViewDeckNavigationControllerIntegrated;
NSLog(@"pushing from %@",self.navigationController);
[self.navigationController pushViewController:deckController animated:YES];

This works great in ios5 but in ios4.3 the "web" is not load (ViewDidLoad is not called) and the screen is blank save for the navbar and tabbar...

The view is being reloaded on viewDidUnload

[self.view removeObserver:self forKeyPath:@"frame"];

Accesses the view with the getter which calls loadView.
Also I would put the viewDidUnload call to super at the end of it.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.