Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

How to hide left menu when tapped a menu in left menu? #101

Open
raitmoon opened this issue Nov 22, 2013 · 9 comments
Open

How to hide left menu when tapped a menu in left menu? #101

raitmoon opened this issue Nov 22, 2013 · 9 comments

Comments

@raitmoon
Copy link

Hello, thanks for your useful library.

I wonder if I can hide left menu when a menu cell is tapped?

Thanks in advance.

@stefanoa
Copy link
Owner

This should happen automatically. Can you explain a little more?

@raitmoon
Copy link
Author

Sorry for my poor explanation.

What I want to do is I want make the first menu cell my app logo cell.
So when user tapped the logo cell("Menu" cell in the screenshot) ,
the original screen before menu icon is tapped should be back.

screen shot 2013-11-23 at 9 10 43 am

@stefanoa
Copy link
Owner

Not sure I understand.
If you need to bring back a Content ViewController that is linked to a cell you simply touch that cell and the content will slide in and hide the Menu.
If you need to present back the view controller that presented the menu the first time it depends on how you presented the menu, if you used a modal segue a push segue or custom segue.

@raitmoon
Copy link
Author

Thanks for your comment.
But I think neither of them.

This is what I want.
screen shot 2013-11-23 at 9 10 43 am2

I checked SASlideMenuRootViewController.h file but couldn't find such function.

@stefanoa
Copy link
Owner

Maybe I am starting to understand. Yo want to present the currently selected Content View Controller when you tap the first cell, in your screenshot the "menu" cell. This is the effect obtained when you tap on the visible part of the selected Content View Controller.
In this case you need to try to intercept the cell selection and try to use the SASlideMenuViewController method:

-(void)selectContentAtIndexPath:(NSIndexPath *)indexPath scrollPosition:(UITableViewScrollPosition)scrollPosition;

@raitmoon
Copy link
Author

Thanks for your support always.

I think the following code is almost what I wanted.
But when selectContentAtIndexPath method is called, the content view controller is reloaded.

-(void) tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath{

if (indexPath.row == 0) { // Menu Cell
    [self selectContentAtIndexPath:lastSelectedIndexPath scrollPosition:UITableViewScrollPositionNone];
} else {
    [super tableView:tableView didSelectRowAtIndexPath:indexPath];
}

}

Now I've looked into SASlideMenuRootViewController and maybe I want to call the method below in tableView didSelectRowAtIndexPath instead.

[self.rootController doSlideToSide];

But xcode says "Reciever type 'SASlideMenuRootViewController' for instance message is forward declaration'.
Mmm...
I appreciate if you can help me again.

@stefanoa
Copy link
Owner

Maybe you are right the best think you can do is to call the SASlideMenuRootViewController method:

-(void) doSlideIn:(void (^)(BOOL completed))completion;

The problem is that it is not a "public" method, thus you have to put the method declaration in the SASlideMenuRootViewController.h file, this should solve the "forward declaration" problem.
You have to use doSlideIn because you want to "slide in" your content View Controller.

@raitmoon
Copy link
Author

Thanks for your comment.

I see that need to call doSlideIn.

But as you said, forward declaration problem is pretty hard for me at the moment.

Hope someone will update some time.

@stefanoa
Copy link
Owner

You should add to SASlideMenuRootViewController.h:

-(void) doSlideIn:(void (^)(BOOL completed))completion;

If it does not works and you have a simple example of your code you can post it here and I will have a look at it.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants