- Avoid switching to ViewController if it's the same class type as the current view controller, and instead just close the slide menu
- this option is configurable by setting a bool called avoidSwitchingToSameClassViewController
This commit is contained in:
parent
d8867cfb3e
commit
4c74a5b105
|
|
@ -22,6 +22,7 @@ typedef enum{
|
|||
|
||||
@interface SlideNavigationController : UINavigationController <UINavigationControllerDelegate>
|
||||
|
||||
@property (nonatomic, assign) BOOL avoidSwitchingToSameClassViewController;
|
||||
@property (nonatomic, strong) UIViewController *righMenu;
|
||||
@property (nonatomic, strong) UIViewController *leftMenu;
|
||||
@property (nonatomic, strong) UIBarButtonItem *leftbarButtonItem;
|
||||
|
|
|
|||
|
|
@ -64,6 +64,7 @@ static SlideNavigationController *singletonInstance;
|
|||
|
||||
- (void)setup
|
||||
{
|
||||
self.avoidSwitchingToSameClassViewController = YES;
|
||||
singletonInstance = self;
|
||||
self.delegate = self;
|
||||
|
||||
|
|
@ -81,6 +82,12 @@ static SlideNavigationController *singletonInstance;
|
|||
|
||||
- (void)switchViewController:(UIViewController *)viewController withCompletion:(void (^)())completion
|
||||
{
|
||||
if (self.avoidSwitchingToSameClassViewController && [self.topViewController isKindOfClass:viewController.class])
|
||||
{
|
||||
[self closeMenuWithCompletion:completion];
|
||||
return;
|
||||
}
|
||||
|
||||
__block CGRect rect = self.view.frame;
|
||||
|
||||
if ([self isMenuOpen])
|
||||
|
|
|
|||
Loading…
Reference in New Issue