Closed maximep closed 11 years ago
Setting nextItemDistance = 0
on the root view controller's layeredNavigationItem
should do the trick, I think. nextItemDistance
controls the minimal distance (in points) from the layer on whose layeredNavigationItem
is altered to the next one. So, when using - [FRLayeredNavigationController initWithRootViewController:configuration:]
you are able to set the nextItemDistance = 0
of the root view controller and that will put the next layer above the root layer if space is needed. And the effect should be that initialViewPosition
of the layer above the root layer should be CGPointMake(0, 0)
.
Isn't that what you are trying to do?
If not: What do I have to click in the Twitter app to see what you mean?
I tried it already but it doesn't have the same behavior as twitter. I want to have 2 layers displayed at the same time only.
For info if you want to set the nextItemDistance to 0 you have to modify your library code to this, otherwise the layer will no be anchored to 0.
CGFloat initX = anchorInitX + (parentNavItem.nextItemDistance >= 0 ? parentNavItem.nextItemDistance : FRLayeredNavigationControllerStandardDistance);
So, not accepting nextItemDistance = 0
was clearly a bug. It's now fixed upstream.
To get to your real problem: Would it be a solution to provide a new property called relativeResidualWidth
that would set the width to a percentage of the residual width (the pixels not used yet when the layers are compressed maximally)? Obviously, the relativeResidualWidth
parameter would get recalculated when the size changes (e.g. when the screen rotates). To imitate the twitter UI, you'd set: relativeResidualWidth = 0.5
(50%) and nextItemDistance = 0
.
Another cool thing is that the maximumWidth:YES
is nothing else than relativeResidualWidth = 1
(100%).
Would that be a solution to your problem?
Hello again,
Do you have a solution to make the selected layer to become the root one (like in twitter).
I found a way to temporarly make it possible in modifying the property "initialViewPosition" to readwrite.
Here is what I do:
(void)tableView:(UITableView )aTableView didSelectRowAtIndexPath:(NSIndexPath )indexPath { [aTableView deselectRowAtIndexPath:indexPath animated:YES];
self.layeredNavigationItem.initialViewPosition = CGPointMake(0, 0);
RangeViewController *rangeViewController = [[RangeViewController alloc] initWithNibName:@"RangeViewController" bundle:nil];
[self.layeredNavigationController pushViewController:rangeViewController inFrontOf:self maximumWidth:YES animated:YES configuration:^(FRLayeredNavigationItem *item) { item.nextItemDistance = 64; item.hasChrome = NO; return; }];
[rangeViewController release]; }
The problem is that modifying this property make the layer to be anchored to point 0. Is there a better way to to this ?
Thanks for help :)