Open Zumbalamambo opened 7 years ago
Use this delegate method:
- (void)revealController:(SWRevealViewController *)revealController panGestureMovedToLocation:(CGFloat)location progress:(CGFloat)progress overProgress:(CGFloat)overProgress {
NSLog(@"Location = %f", location);
}
Thanks bro...Should i implement it in MainViewController? Im following Appcoda's example
Yes or in your menu view controller or in AppDelegate
@iDevelopper Thanks bro but It is not printing the xLocation coordinates. This is my MainViewController.h file
#import <UIKit/UIKit.h>
#import "SWRevealViewController.h"
@interface MainViewController : UIViewController<SWRevealViewControllerDelegate>
@property (weak, nonatomic) IBOutlet UIBarButtonItem *sidebarButton;
@end
This is my MainViewController.m file
#import "MainViewController.h"
@interface MainViewController ()
@end
@implementation MainViewController
- (void)viewDidLoad {
[super viewDidLoad];
self.title = @"Compfie";
SWRevealViewController *revealViewController = self.revealViewController;
revealViewController.rearViewRevealWidth = 300;
revealViewController.delegate = self;
if ( revealViewController )
{
[self.sidebarButton setTarget: self.revealViewController];
[self.sidebarButton setAction: @selector( revealToggle: )];
[self.view addGestureRecognizer:self.revealViewController.panGestureRecognizer];
}
}
- (void)revealController:(SWRevealViewController *)revealController panGestureMovedToLocation:(CGFloat)location progress:(CGFloat)progress overProgress:(CGFloat)overProgress {
NSLog(@"Location = %f", location);
}
- (void)didReceiveMemoryWarning {
[super didReceiveMemoryWarning];
// Dispose of any resources that can be recreated.
}
/*
#pragma mark - Navigation
// In a storyboard-based application, you will often want to do a little preparation before navigation
- (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender {
// Get the new view controller using [segue destinationViewController].
// Pass the selected object to the new view controller.
}
*/
@end
The method revealController is being called but....
How can I be able to sort this out bro?
No, when tapping the button there is no callback, only willMoveToFrontViewPosition and didMoveToFrontViewPosition. 319 or 346 is the end of your swipe gesture but you know your rearRevealWidth.
Thank you bro..May I know the icon size of the slidingmenu icons? It appears big in my app
I use 25 for 1x, 50 for 2x and 75 for 3x.
Thanks bro...
I need to animate a uiview when the user slides the sliding menu.To animate the UIView, I need to know the sliding offset when the rear view is sliding. How can I be able to get the offset in real time basis? For instance, I have set that that width of the sliding menu as 300.
Now when the user slides the sliding menu, I would like to get the offset from 0 to 300 when it is sliding.