matghazaryan / AMSlideMenu2

Sliding Menu for iOS (Left and Right menus). Multiple storyboards and XIBs support.
MIT License
1.2k stars 194 forks source link

Can we use UIViewController for left menu instead of UITableViewController in this AMSlideMenu version? #150

Closed daljeet16 closed 9 years ago

daljeet16 commented 9 years ago

I am using this library in my app for side menu and is working fine as such, but but I have a specific requirement which I am unable to achieve with the current version.

When I add a view in UITableViewController, then the complete view is scrolling which I don't want.That is why I tried to add UIViewController containing a tableview which has a view as a subview of UIViewController. But in this case, AMSlideMenu stops working.

This functionality is absolutely similar to the attached screenshot from google maps app, which has the top part as static and the list is scrollable.

img_3001

Is there any solution to meet this design requirement ? ( in a new release probably ) Help is appreciated, thanks!

arturdev commented 9 years ago

Unfortunately you can't use UIViewController as menu in this version of AMSlideMenu. But you can achieve that with UITableViewController too. E.g. you can set tableview style to group, and use section header's view.

arturdev commented 9 years ago

Or, If you look at this: link, you can see a little hack (in -setFixedStatusBar method) that I made in UITableViewController. This partly makes UITableViewController like UIViewController. Just replace statusBarView with your static header view :)

daljeet16 commented 9 years ago

Hi Artur

I have implemented as same as you suggested with viewForHeaderInSection and its working fine. Thanks a lot for the same.

I'm facing another issue now while implementing this, I hope you can help in the same.

I'm using AMSlideMenu with storyboards and implemented with tab bar viewController, but now the slider button is not appearing in the navigation bar. This is the code in MainVC.m :-

I have tried putting breakpoint in the above code and the code executes, but the button does not appear. Look forward to your help.

Thanks so much !

arturdev commented 9 years ago

Can you make a demo project and send it to me via email (mkrtarturdev@gmail.com) ? I can't say anything without looking what have you done :)

hardikamal commented 9 years ago

@daljeet16 even i want to setup this type of layout on left menu.... how did u solve can u plz share the code of it??

daljeet16 commented 9 years ago

@hardikamal here is the code.

-(CGFloat)tableView:(UITableView *)tableView heightForHeaderInSection:(NSInteger)section{ return 170.0f; }

hardikamal commented 9 years ago

@daljeet16 where do i place this code....and what is this variable userName that is giving some error plz help

daljeet16 commented 9 years ago

You have to put in AMSlideMenuLeftTableViewController class I updated the comment it is userImage not userName.

daljeet16 commented 9 years ago

Hi Artur

@arturdev I created a sample project with storyboard and tabBar, in that everything is working fine the button appear in navBar but when I did the same thing in my app project the slider button is not coming.

I can't share my whole project with you is there any other way to solve this issue.

hardikamal commented 9 years ago

@daljeet16 Solved thanks bro

arturdev commented 9 years ago

Actually it isn't good practice to make changes in the Library. I strongly recommend you to make a subclass from AMSlideMenuLeftTableViewController and do your customizations there.

hardikamal commented 9 years ago

@arturdev yeah did that only...Thanks for the suggestion and awesome library

daljeet16 commented 9 years ago

@arturdev This is my storyboard structure,hope it give some clarity to you

screen shot 2015-05-14 at 5 47 52 pm

arturdev commented 9 years ago

Hmm. Try [self addLeftMenuButton] in that view controller. And don't forget to import "UIViewController+AMSlideMenu.h"

arturdev commented 9 years ago

@hardikamal You're welcome! :)

daljeet16 commented 9 years ago

@arturdev its working thanks!

arturdev commented 9 years ago

@daljeet16 You're welcome!