Closed SubodhBQT closed 6 years ago
I wrote this sample:
If you want some more features in this project (as push etc...), tell me.
Thanks for your support, You save my lot of time. I tested sample code and it is as per my requirement. Now i am going to integrate in my project. Definitely i will tell if anything more needed.
Thanks a lot Patric.
Hi Patric , One problem i am facing. I want to disable main view touch action if left or right side view open. I tried with this but not getting work.
if (self.revealViewController.isLeftViewOpen || self.revealViewController.isRightViewOpen)
[self.revealViewController.mainViewController.view setUserInteractionEnabled:NO];
else
[self.revealViewController.mainViewController.view setUserInteractionEnabled:YES];
Any suggestion.
Thanks
Hello,
Adopt PBRevealViewControllerDelegate and use some delegate methods as willShowLeft or didShowLeft... and willHideRight or didHideRight:
example: PBRevealTabObj 2.zip
#pragma mark - PBRevealViewController delegate
- (void)revealController:(PBRevealViewController *)revealController willShowLeftViewController:(UIViewController *)controller
{
revealController.mainViewController.view.userInteractionEnabled = NO;
revealController.mainViewController.view.alpha = 0.8;
}
- (void)revealController:(PBRevealViewController *)revealController willHideLeftViewController:(UIViewController *)controller
{
revealController.mainViewController.view.userInteractionEnabled = YES;
revealController.mainViewController.view.alpha = 1.0;
}
- (void)revealController:(PBRevealViewController *)revealController didShowRightViewController:(UIViewController *)controller
{
revealController.mainViewController.view.userInteractionEnabled = NO;
revealController.mainViewController.view.alpha = 0.8;
}
- (void)revealController:(PBRevealViewController *)revealController didHideRightViewController:(UIViewController *)controller
{
revealController.mainViewController.view.userInteractionEnabled = YES;
revealController.mainViewController.view.alpha = 1.0;
}
Can i restrict user for specific right and left dragging. In my app if user is in english language then right dragging not possible. Currently i tried with setting this self.revealViewController.rightViewRevealWidth = 0; . But some how it opening few portion of right view.
This was i achived using velocity using SWRevealviewcontroller.
Setting rightViewRevealWidth to 0.0 normally works. But you can achieve with this delegate method (example):
- (BOOL)revealControllerPanGestureShouldBegin:(PBRevealViewController *)revealController direction:(PBRevealControllerPanDirection)direction
{
NSLocale *currentLocale = [NSLocale currentLocale];
NSString *countryCode = [currentLocale objectForKey:NSLocaleCountryCode];
if (direction == PBRevealControllerPanDirectionLeft && [countryCode isEqualToString:@"US"]) {
return NO;
}
return YES;
}
Thanks lot, finally i replaced SWReveal with PBReveal and achieved all featured that was implemented with SWReveal. I will give this library 5 star.
Welcome, with pleasure! Don't hesitate if you have any questions. And if you can tell me what is the application on the store, I could have a look of your work and mine!
My app is under development for new version, so it is not released yet. I will let you know once pushed to store.
Thanks
@iDevelopper Can you please give sample code in swift 3 also with menu covering entire screen including top navigation bar and bottom tab bar?
i need the arrangement exactly like https://github.com/John-Lluch/SWRevealViewController/files/275828/SWTabBarSwift2.zip
but i need that side menu over the viewcontroller.please help @iDevelopper
Can you upload a screenshot please?
thanks for the response @iDevelopper . im attaching the design i want to achieve
i want to show menu comes over top navigation and bottom Tabbar also..at the sametime i want to show the bottom tabbar in all pages navigating from this sidemenu. (The side menu has viewcontrollers in bottom tapbar and also viewcontrollers not in tabbar.i want to show the bottam tab bar in every page)
https://github.com/John-Lluch/SWRevealViewController/files/275828/SWTabBarSwift2.zip
The above one is exact item i want,but i want the menu come over the viewcontrollers.
Ok for menu, no problem. If you want to present the others views and keep the tab bar items visibles I think you have to add the subview of the controller that is not part of tab bar controller to the active view.
Revisited sample with PBRevealViewController. In the sample it is not a UITabBarController but a UITabBar in a container view controller. Because if you want to present views with tab bar items visibles you have to dehighlight them...
@iDevelopper ,thanks a lotttt man..you saved me.Great thanks to you.Love you.
@iDevelopper ,im facing an issue ,how can i load the page, i mean the ContainerViewController in the above sample from appdelegate ?
I don't understand the question. ContainerViewController is the main view controller of PBRevealViewController. Do you want to create the reveal controller programmatically from AppDelegate and not from storyboard?
@iDevelopper ..no sir.First of all thanks for your reply sir.Actually ContainerViewController is home page in my project.After login ,its loading this main viewController (ContainerViewController). Once successfully login,next time when opening the app,no need to show the login page know? so im storing a bool value in user defaults and checking if it is true in didFinishlaunching func in app delegate..
Im using this code with didFinishLaunchingWithOptions.
let isLoggedIn = UserDefaults.standard.bool(forKey: "isLoggedIn")
if isLoggedIn{
loggedUserId = UserDefaults.standard.value(forKey: "userId") as! String
let storyboard = UIStoryboard(name: "Main", bundle: nil)
let containerViewController = storyboard.instantiateViewController(withIdentifier: "RevealViewController") as UIViewController
self.window = UIWindow(frame: UIScreen.main.bounds)
self.window?.rootViewController = containerViewController
self.window?.makeKeyAndVisible()
}
But it is giving crash all time. fatal error: unexpectedly found nil while unwrapping an Optional value. Please help
The root view controller must be the reveal view controller not the container view controller.
func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplicationLaunchOptionsKey: Any]?) -> Bool {
// Override point for customization after application launch.
let isLoggedIn = UserDefaults.standard.bool(forKey: "isLoggedIn")
if isLoggedIn {
loggedUserId = UserDefaults.standard.value(forKey: "userId") as! String
let storyboard = UIStoryboard(name: "Main", bundle: nil)
let revealController = storyboard.instantiateViewController(withIdentifier: "RevealViewController") as! PBRevealViewController
self.window = UIWindow(frame: UIScreen.main.bounds)
self.window?.rootViewController = revealController
self.window?.makeKeyAndVisible()
}
return true
}
But I think it will be better to always load the Login view controller and perform the segue to reveal if the user is already logged in. And implement a Logout to come back in Login view controller.
@iDevelopper ,thank you sir.it works
Hi Patric,
As you know i am using "PBRevealViewController" to use side menu in my app. Suddenly i came with one requirement. My main view has collection view that is scrollable left right. And my requirement is like if user drag side menu from divce edge where scrollable collection view. Currently no side menu appears due to scrollable collection view. Any work around for that.
Thanks Subodh
You could use the panFromLeftBorderWidth property, for example set it to 50. The left side will open only if the user pan from less or equal than 50 points from the left border.
And you have to implement the delegate function:
// MARK: - SWRevealViewController delegate
func revealController(_ revealController: PBRevealViewController, panGestureRecognizerShouldRecognizeSimultaneouslyWithGestureRecognizer otherGestureRecognizer: UIGestureRecognizer, direction: PBRevealControllerPanDirection) -> Bool
{
return true
}
Hi Patric,
Can you make sample for side in menu that comes over "front/main view along with tab bar " with transparency ? It should be in objective c and storyboard with tab bar based application using PBRevealViewController library.
Thanks