pkluz / pkrevealcontroller Goto Github PK
View Code? Open in Web Editor NEWPKRevealController is a delightful view controller container for iOS, enabling you to present multiple controllers on top of one another.
License: Other
PKRevealController is a delightful view controller container for iOS, enabling you to present multiple controllers on top of one another.
License: Other
First of all thank you for this great repo!
I found a bug using the controller on iOS 5 which gets the controller stuck between front and rear showing.
The problem with this is that the FrontViewPosition is still set to FrontViewPositionLeft. So when you now press one of the buttons in the tableview it hides the frontview instead of showing it!
To achief this:
or
Sample Video (bad quality, sorry)
Hi,
It is a bit difficult to explain. When you are in rear view, the taps in the overlapped front view are still recognized.
For example you can click the push button, you can move the map.
In the Facebook and Path app, the front view is shown if you tap on the overlapped front view.
I hope you understand what I mean,
Greets
Michael
Hello,
When iOS 6 support is offical can you tag a new version, and update the podspec for cocoa pods?
Hey pkluz,
In my app I need some view controllers to support portrait & landscape mode and some only portrait mode.
But it seams that I can't get this control for each view controller, because no matter how I implement shouldAutorotateToInterfaceOrientation in those view controllers it doesn't do anything, and the only one metters is the shouldAutorotateToInterfaceOrientation of the reveal controller itself.
For example I have tried to change the MapViewController in the example code, to support ONLY portrait mode. So I implemented shouldAutorotateToInterfaceOrientation to portrait only, but it has no effect and the map view still rotate to landscape...
Thanks a lot for your help & your code
The protocol should include methods like "willRevealLeftRearView:" etc.pp.
You define the enum as public but not the property.
Hi, pkluz. ZUUIRevealController is an great iOS class, i'm using it in my photo viewer app now, i want to show or hide status bar when user tap photo gallery view. But ZUUIRevealController doesn't resize itself automatically when hide status bar, how to solve this issue? Many thanks@
I am thinking when the rear view is revealed, the "Push!" button in the sample code should not push other view inside the hidden front view. I am expecting the behavior of the front view while the rear view is active is either of these:
While running in iPhone (Retina 4Inch) simulator the height of [rearViewController View] is
frame = (0 0; 320 480) instead of frame = (0 0; 320 568).
So the rear view seem to be truncated.
But this issue is not there for frontViewController.
I'm slowly adapting the demo app code and the first thing I've done is swap out the XIB drawn RearViewController with a vanilla UITableViewController object.
I don't declare a frame to the newly create controller's view.
It seems to adopt the application frame, complete with 20px offset for the status bar by default, so it's placed in the rear view position but with a 20px gap between the bottom of the status bar and the top of the rear view.
Am I implementing this wrong? Is this a bug in the way that non XIB controlled views adopt their default frame?
Right now there's a couple of lines of code needed inside both the Front- and the RearViewController to make everything work. Get rid of most of it.
Hey!
Is it possible to make the RearViewController dismiss itself when the FrontViewController is clicked?
In the following picture, for example, when the view to the right is clicked. http://cl.ly/0v1Y2m1s0h3f0x211N1G
First of all good job done here on this project.
I am using this solution for my FB-like menu in my app. The problem is when menu view (rear view) is revealed on top of menu view appears black space, like black bar. So I had to do frame adjustment in method _addRearViewControllerToHierarchy.
So my fix was same like in method _addFrontViewControllerToHierarchy.
Here is the whole method and line that added:
(void)_addRearViewControllerToHierarchy:(UIViewController *)rearViewController
{
[self addChildViewController:rearViewController];
// line added by balabs - fixed my problem
rearViewController.view.frame = CGRectMake(0.0f, 0.0f, self.rearView.frame.size.width, self.rearView.frame.size.height);
[self.rearView addSubview:rearViewController.view];
if ([rearViewController respondsToSelector:@selector(didMoveToParentViewController:)])
{
[rearViewController didMoveToParentViewController:self];
}
}
Apart from this I have no other problems so far.
Best regards,
Dejan
Hello,
Ever since the upgrade to ARC compatible project, i can no longer call the plain old revealToggle method without getting an EXC_BAD_ACCESS error...
When the device is in landscape mode and you send the hideFrontView
message, the rear view controller does not completely take over the screen, pushing the front view controller offscreen. The Facebook app's rear view takes over the screen on search for both orientations, and this seems to mesh with what a rear view presentation mode should do.
In the Facebook implementation, when you expand to view the rear view controller, you can drag anywhere on the partially hidden front view controller to bring it back to focus. That view doesn't otherwise respond to touch events (you can't scan down your timeline whilst in the collapsed state).
In the demo app provided with ZUUIRevealController, when using the map view any interaction with the map when partially hidden pans the map. It would be better to prevent the touch events reaching this VC and instead use them to control the position of the front view as when you draw the navigation bar?
Please, submit your changes into Specs repo.
Is there any easy way to make the reveal edge appear from right or left at runtime? I'm trying to use this for left or right-handed users. If you give me a hint on what I should look into I'd be glad to implement it!
Not sure, if this should be an issue or may be i am looking for help :)
UITableViews(rather any UIScrollView) that are inside the frontViewController are not responding to statusbar's tap. The usual behavior is to scroll the view to top on touching the status bar.
It works as expected without a ZUUIRC, but inside it, the functionality is lost. Any suggestions?
Edit: Or is it because, rearview has a table and it conflicts with the table on frontview? Apple docs say, there can't be 2 scroll views. But again, i have tried setting scrollsToTop property to NO inside rearView's table.
Thanks
in your demo, i insert a UItextview in MapViewController.xib. When i enter value in textbox and have a error EXC_BAD_ACCESS.
You can check and support me, please. Your control is very great.
Thank so much ^^
I am using a table view as rear view. But the table view is as width as the screen, so the right part of the table view is invisible, because it is overlapped by front view.
Is there be a chance to limit the width of the rear view, to only the visible width?
Btw. nice project!
thanks for sharing this fantastic code :)
It seams that the didHideRearViewController delegate doesn't get called if I pan the navigation bar to hide the rear view.
This happen only if I don't release my finger till the rear view is completely hidden.
Hello, this is probably a tall order, as would require significant memory management etc... But what would be really awesome to have is view persistance, as the tab bar controller does. So the user is doing something in one view, heads to another view, and then heads back to their first view, and it would be in the state they left it in, without having to reload a new view each time.
This is more of a noobish question, been banging my head for a few days.
I got the reveal rearview working with a uinav controller, but I cannot figure out how to get a simple button action to push another view controller to the frontView.
Or toggle the frontView back with a button on the rearview for that matter.
any help would be appreciated, thanks.
My rearViewController is a simple TableViewController and my frontViewController has a UINavigationBar and a UIScrollview with several views inside it (pages of a book).
When I revealToggle, the frontViewController goes to right, but the hidden page on UIScrollView appears in front of rearViewController as the image below:
Am I doing something wrong?
This is the code I'm using to toggle the rearViewController:
UINavigationItem *item = [[UINavigationItem alloc] initWithTitle:@"Title"];
item.leftBarButtonItem = [[UIBarButtonItem alloc] initWithTitle:@"Menu"
style:UIBarButtonItemStylePlain
target:self.parentViewController.parentViewController
action:@selector(revealToggle:)];
item.hidesBackButton = YES;
[self.navigationBar pushNavigationItem:item animated:NO];
And this is the code to create the ZUUIRevealController:
BSMainMenuViewController *mainMenu = [[BSMainMenuViewController alloc] initWithStyle:UITableViewStylePlain];
mainMenu.title = @"Menu";
mainMenu.navigationController.navigationBarHidden = NO;
ZUUIRevealController *revealController = [[ZUUIRevealController alloc] initWithFrontViewController:self.viewController
rearViewController:mainMenu];
self.window.rootViewController = revealController;
Steps to reproduce:
Actual result:
Expected result:
Note #1: You can reproduce this issue on your sample project - just replace
[self.navigationController pushViewController:stubController animated:YES];
with
stubController.modalTransitionStyle = UIModalTransitionStyleFlipHorizontal;
[self.navigationController presentModalViewController:stubController animated:YES];
Note #2: This does not happen for default modal transitioning style "cover vertical".
See Path's implementation (http://path.com).
Note:
"Magnetic Edges" in path's implementation don't feel quite right. The front-view is "too slippery". Improve on that.
Hi there,
is there any posibility to get this working Xcode 3.X with iOS SDK 4.3 or 4.2.1? Would be great for me cause i want a application wich is compatible with the iPhone 3G and the iPod touch 2G.
Thanks, Xomz.
Hi there,
I have been having this issue where viewDidDisappear is not called on the frontViewController
I followed the example, where i have a rearview controller with a table, clicking on an tablecell in the rearview controller, changes frontviewcontroller. All works well.
However, in each controller, there is code inside viewDidDisapper, for me to do some stuff when the frontView Changes. This method however is not fired at all.
How can i get those methods to be fired?
if ([frontViewController respondsToSelector:@selector(removeFromParentViewController:)])
{
[frontViewController removeFromParentViewController];
}
[frontViewController removeFromParentViewController]; never called because thereis now selector @selector(removeFromParentViewController:). You should remove ": "
if ([frontViewController respondsToSelector:@selector(removeFromParentViewController)])
{
[frontViewController removeFromParentViewController];
}
I am working on an app with this awesome little tool, but it needs to be backwards compatible with iOS 4.3 in this case. There are a few areas where the code in your example project needed to be modified (manually calling the ViewWillAppear methods)... I noticed the rotation problem issue had been logged, this is still happening when trying to use this tool on iOS 4.3 but it is happening even when you don't use modal views...
I was wondering if you were able to test this and provide a fix? I realise it's an outdated OS, but i'm desperate to use this tool, so will be trying to work on a fix myself. I think you'll probably be quicker though!
Edit: Just read some of the other issue posts, seems i'm not the only one with the problem. Sorry for creating a duplicate issue, but consider me a +1 to the iOS 4 support request :-)
Is it possible to auto change the navigation bar back button to be the "Reveal" button when the Rear View is reveal?
I will try to explain my self, if I push a view controller on top of the Front View, the navigation left button of course change from "Reveal" to "Front View".
If I now panning my finger to reveal the Rear View, I will still see the "Front View" back button, and I will still be able to tap it and go back in the view hierarchy.
So maybe it's better to change the "Front View" back button to "Reveal" button when the Rear View is reveal, and return it to what it was when the Rear View is hidden (like in the Facebook app, they also do the change of the buttons with nice animation)
The downloaded zip file does not run out of the box for me. I see two errors they are as follows:
// First error -- Main.h
(1) unexpected '@' in program
@autoreleasepool
^
// Second error
(2) The document "FrontViewController_iPad.xib" could not be opened. The operation couldn’t be completed. -[IBUIScreenMetrics initWithCoder:]: unrecognized selector sent to instance 0x10066b360. With this one i deleted the IPad.xib because I am programing for the iphone. The error went away but the first one is still there.
Also it seems youv'e done some changes with @autoreleaspool in the main.m file is this change and your code for 5.0 only?
FYI I am using SDK Simulator 4.2 Any help would be appreciated
Create extensive tutorial, tags and co.
After upgrading to iOS 5.1 I have noticed a bug, cannot confirm that this does not occur on other versions of iOS as well, but the issue is this..
I have customised the rear view controller table view, using custom cells, selection styles, etc... When i pop a modal view controller on the front view, and then exit that modal view, if I reveal the rear view controller, the table formatting is lost, cell backgrounds are not drawn etc, until they are flicked off the screen and back on again by scrolling the table view.
EDIT: Should note that this issue is not present on the iPad (2), but is on the iPhone (4s)...
When the front view controller is a UINavigationController
, pushing a new view controller on to the navigation stack with the controller's hidesBottomBarWhenPushed
property set to YES
does not hide the UITabBar.
I can only assume this is related to the fact that the TabBarItem is currently assigned to a ZUUIRevealController instance and not directly to the front view controller.
Is there a fix for this?
So I have my app setup like example project, where there is a pan GR on navigation controller in front view, and I have a table view inside that nav controller.
The problem is that as soon as I start to drag a cell inside the table, pan recogniser takes over and dragging is cancelled.
iOS6 requires some changes in order to enable rotation. It's still NDA, but the change is very minor. Should I make a pull request or just wait few more days?
On iOS4 methods like viewWillAppear: viewDidAppear: viewWillRotateToInterfaceOrientation viewDidRotateToInterfaceOrientation does not get called.
ZUUIRevealController does not crash anymore on iOS4, but there are UI issues on front/rear views if you have some code in the lifecycle methods mentioned above.
I think you need to call those lifecycle methods from ZUUIRevealController manually on iOS4.
I was wondering if its possible to reveal a view controller behind the front view by sliding it down instead of sliding right/left. If so how can i do this.
Right now, if you pan your finger further than the right edge (which the front-view docks to if revealed) the sin-function used to slow the translation is good and does the job - but not well enough. It feels too abrupt.
Following scenario:
Problem is that the new "_loadDefaultConfiguration" method will only called inside "initWithFrontViewController".
Without it the front view won't move because of the missing defaults.
Cheers,
Jens
See path's implementation.
@pkluz I have an issue with the drop shadow that is created. I've noticed on iPad the drop shadow doesn't extend vertically to fill the screen. I can force the shadow to fill the remaining vertical space by changing the UIBezierPath's frame in ZUUIRevealController.m in viewDidLoad, but that's a hack. I want to ensure that my view controller's frame is an appropriate size and let the UIBezierPath do it's thing. I'd like to know why self.frontView.bounds is returning an iPhone sized CGRect even when an iPad-sized NIB has been init'd for the view controller that has been passed to it?
Here's what I'm doing in my project. I have a UITableViewController as my rearViewController and a simple MapView as my frontViewController. At run time I init my MapView VC with an appropriately sized iPad view whose frame is 768/1024. I can verify the appropriate frame size prior to the call to the ZUUIRevealController's viewDidLoad method. The bounds self.frontView.bounds on line 733 still reports a dimension of 320/548, even though the view controller whose view will be added to the frontView property has a different dimension.
I am setting the front view controller in response to a push notification, and when I call - (void)setFrontViewController:(UIViewController *)frontViewController
, the rear view controller is displayed automatically, but is there a way to disable the rearViewController from displaying on a case by case basis?
In my use case, a user receives a push notification and launches the app from an inactive state. I want to programmatically switch the front view controller to the one that may or may not be the current frontViewController, without having the rearViewController display.
If you modify FrontViewController.m in the example project by 1) adding #import "RevealController.h"
and 2) replacing - (IBAction)pushExample:(id)sender
with the following, the "Push!" button will call setFrontViewController:
& the frontViewController is set, but you'll see that the rearViewController slides out as well:
- (IBAction)pushExample:(id)sender
{
UIViewController *stubController = [[UIViewController alloc] init];
stubController.view.backgroundColor = [UIColor whiteColor];
RevealController *revealController = [self.navigationController.parentViewController isKindOfClass:[RevealController class]] ? (RevealController *)self.navigationController.parentViewController : nil;
[revealController setFrontViewController:stubController];
}
file also here: https://gist.github.com/4341159
On request.
ZUUIRevealController does not work fine with modal view controller and rotation.
Steps to reproduce the issue:
Actual result:
A half of screen if black. Rotating back and forth to portrait orientation does not help.
N.B. You can easily reproduce this issue on your sample project if you just change pushViewController to presentModalViewController.
I'm just throwing this out there to see if anyone is interested. ZUUIRevealController
is the best implementation I've seen of the slide-out navigation pattern, especially with its minimal implementation that doesn't attempt to solve every scenario, so I can understand why the following idea might not be applicable.
I've come to view this reveal/slide-out navigation pattern as similar to the iPad's UISplitViewController
, that is, another way to present a master-detail interface. In my own project, I've written a wrapper and protocol to make ZUUIRevealController
's interface a subset of UISplitViewController
's interface – this allows for switching out different concrete master-detail implementations depending on the device's UIUserInterfaceIdiom
.
If this interests anyone else, I'd volunteer to cleanup my changes and submit a patch that would make ZUUIRevealController
adhere to the following protocol:
#import <Foundation/Foundation.h>
/**
* `MasterDetailViewController` defines a protocol for a container
* `UIViewController` that manages a child master view controller and a child
* detail view controller.
*
* This container view controller could be, for example, a `UISplitViewController`
* on an iPad, a `ZUUIRevealController` on an iPhone, or any different concrete
* implementation that had some notion of two child view controllers.
*
* *-------------------------------------------*
* | | |
* |------------|------------------------------|
* | | |
* | M | D |
* | A | E |
* | S | T |
* | T | A |
* | E | I |
* | R | L |
* | | |
* *____________|______________________________*
*/
@protocol MasterDetailViewController <NSObject>
/**
* The array of view controllers managed by the receiver.
*
* @discussion The `viewControllers` property is present to attempt some
* interface parity with `UISplitViewController`. Therefore,
* mimicking `UISplitViewController`, the array in this property must
* contain exactly two view controllers. The view controller at index
* 0 is considered the *master* view controller. In the case of
* `ZUUIRevealController`, the view controller at index 0 would be
* the rear view controller. The view controller at index 1 would be
* the front view controller of `ZUUIRevealController`, i.e., the view
* controller that can slide out to reveal the rear view controller.
*/
@property (nonatomic, copy) NSArray *viewControllers;
/**
* The delegate you want to receive master-detail view controller messages.
*
* @discussion The master-detail view controller uses its delegate to manage
* certain behavior based on the type of `MasterDetailViewController`.
* For example, if this view controller is a `UISplitViewController`,
* the `delegate` should conform to the `UISplitViewControllerDelegate`
* protocol to manage the showing and hiding of related view
* controllers. If this view controller is a `ZUUIRevealController`,
* it should conform to the `ZUUIRevealControllerDelegate`
* protocol.
*/
@property (nonatomic, assign) id delegate;
@end
Thanks for such a nice project!
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.