2

I'm using three20 on a app and I would like to use this kind of menu that are using on Path and Facebook:

path app slide menu

My app is very intensive using TTNavigator url scheme, and it seems that TTNavigator is like having exclusive control of the window. So I have not two view controllers to play.

Is there any way I can add TTNavigator to a view controller and create my menu on the other?

david
  • 200
  • 1
  • 14

2 Answers2

0

You can have a Path-like sliding left view controller by using Tom Adriaenssen's excellent ViewDeck implementation:

ViewDeck on GitHub

In your app, when setting navigator.window, don't pass a window. Pass the UIView of a custom UIViewController (the one that you will set as the 'central' view controller in ViewDeck:

navigator.window=(UIWindow*)myCentralViewController.view;

this will fool three20's TTNavigator into thinking that it has successfully taken over your window, when in fact, it's just a view. Note, however, that you might need to subclass that view and implement empty UIWindow's methods, such as:

- (void)makeKeyAndVisible{}

.. because three20's TTNavigator still thinks that this is your main UIWindow and expects your object to respond to common UIWindow selectors.

This is uncharted territory and it certainly is a bit of a hack that might have unintended consequences.

You might need to set a negative y on your "fake window" frame, to compensate for the status bar. e.g.:

[[MYFakeWindow alloc] initWithFrame:CGRectMake(0, -20, 320, 480)];

Again, be careful. I'm using this hack in an app where it behaves very well, but you're still fighting the three20 framework, so make sure it doesn't bite back.

magma
  • 8,432
  • 1
  • 35
  • 33
0

ok, I've found a solution :

SMMenu * smmenu = [[SMMenu alloc] init];
[self.window addSubview: smmenu.view];
[self.window addSubview: navigator.window];
[self.window makeKeyAndVisible];

only need to move to the left navigator.window on a press of a button like this : [navigator.window setLeft:250] and it will show the view at the back, and all the navigator will work at front view.

Well. Unfortunately, now I have lost the keyboard view.. :)

david
  • 200
  • 1
  • 14
  • Perhaps because you moved the window (`navigator.window`)? Normally you don't have multiple windows in an iOS app, and IIRC, the Keyboard view makes some assumptions about the window over which it will show itself. – Tim Shadel Sep 07 '12 at 11:47