iOS view controller which manages left and right side views
Fix bugs
Fix bugs, refactoring
root
, left
and right
view controllers right from storyboard using segues.
You need to create side menu
segue or Custom
segue of class LGSideMenuSegue
and set identifier to root
, left
or right
. For more info read README.md
- (void)showLeftView;
- (void)hideLeftView;
- (void)toggleLeftView;
- (void)showLeftViewAnimated;
- (void)hideLeftViewAnimated;
- (void)toggleLeftViewAnimated;
- (void)showRightView;
- (void)hideRightView;
- (void)toggleRightView;
- (void)showRightViewAnimated;
- (void)hideRightViewAnimated;
- (void)toggleRightViewAnimated;
When side view hide automatically by touch
/** Default is YES */
@property (assign, nonatomic) IBInspectable BOOL shouldHideLeftViewAnimated;
/** Default is YES */
@property (assign, nonatomic) IBInspectable BOOL shouldHideRightViewAnimated;
If you have some visual bugs while animating
/**
Rarely you can get some visual bugs when you change view hierarchy and toggle side views in the same iteration
You can use delay to avoid this and probably other unexpected visual bugs
*/
- (void)showLeftViewAnimated:(BOOL)animated delay:(NSTimeInterval)delay completionHandler:(LGSideMenuControllerCompletionHandler)completionHandler;
- (void)hideLeftViewAnimated:(BOOL)animated delay:(NSTimeInterval)delay completionHandler:(LGSideMenuControllerCompletionHandler)completionHandler;
- (void)toggleLeftViewAnimated:(BOOL)animated delay:(NSTimeInterval)delay completionHandler:(LGSideMenuControllerCompletionHandler)completionHandler;
- (void)showRightViewAnimated:(BOOL)animated delay:(NSTimeInterval)delay completionHandler:(LGSideMenuControllerCompletionHandler)completionHandler;
- (void)hideRightViewAnimated:(BOOL)animated delay:(NSTimeInterval)delay completionHandler:(LGSideMenuControllerCompletionHandler)completionHandler;
- (void)toggleRightViewAnimated:(BOOL)animated delay:(NSTimeInterval)delay completionHandler:(LGSideMenuControllerCompletionHandler)completionHandler;
Improvements
Fix bugs
Improvements
Rotation now enabled even when side views is showing.
Fixed bugs in demo projects with storyboard
- (nonnull instancetype)initWithRootViewController:(nullable UIViewController *)rootViewController;
+ (nonnull instancetype)sideMenuControllerWithRootViewController:(nullable UIViewController *)rootViewController;
- (nonnull instancetype)initWithRootViewController:(nullable UIViewController *)rootViewController
leftViewController:(nullable UIViewController *)leftViewController
rightViewController:(nullable UIViewController *)rightViewController;
+ (nonnull instancetype)sideMenuControllerWithRootViewController:(nullable UIViewController *)rootViewController
leftViewController:(nullable UIViewController *)leftViewController
rightViewController:(nullable UIViewController *)rightViewController;
- (nonnull instancetype)initWithRootView:(nullable UIView *)rootView;
+ (nonnull instancetype)sideMenuControllerWithRootView:(nullable UIView *)rootView;
- (nonnull instancetype)initWithRootView:(nullable UIView *)rootView
leftView:(nullable UIView *)leftView
rightView:(nullable UIView *)rightView;
+ (nonnull instancetype)sideMenuControllerWithRootView:(nullable UIView *)rootView
leftView:(nullable UIView *)leftView
rightView:(nullable UIView *)rightView;
@property (assign, nonatomic, getter=isShouldShowLeftView) IBInspectable BOOL shouldShowLeftView
DEPRECATED_MSG_ATTRIBUTE("use leftViewEnabled instead");
@property (assign, nonatomic, getter=isShouldShowRightView) IBInspectable BOOL shouldShowRightView
DEPRECATED_MSG_ATTRIBUTE("use rightViewEnabled instead");
@property (assign, nonatomic, readonly, getter=isLeftViewAlwaysVisible) BOOL leftViewAlwaysVisible
DEPRECATED_MSG_ATTRIBUTE("use leftViewAlwaysVisibleForCurrentOrientation instead");
@property (assign, nonatomic, readonly, getter=isRightViewAlwaysVisible) BOOL rightViewAlwaysVisible
DEPRECATED_MSG_ATTRIBUTE("use rightViewAlwaysVisibleForCurrentOrientation instead");
- (BOOL)isLeftViewAlwaysVisibleForInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation
DEPRECATED_MSG_ATTRIBUTE("use isLeftViewAlwaysVisibleForOrientation instead");
- (BOOL)isRightViewAlwaysVisibleForInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation
DEPRECATED_MSG_ATTRIBUTE("use isRightViewAlwaysVisibleForOrientation instead");
- (void)setLeftViewEnabledWithWidth:(CGFloat)width
presentationStyle:(LGSideMenuPresentationStyle)presentationStyle
alwaysVisibleOptions:(LGSideMenuAlwaysVisibleOptions)alwaysVisibleOptions DEPRECATED_ATTRIBUTE;
- (void)setRightViewEnabledWithWidth:(CGFloat)width
presentationStyle:(LGSideMenuPresentationStyle)presentationStyle
alwaysVisibleOptions:(LGSideMenuAlwaysVisibleOptions)alwaysVisibleOptions DEPRECATED_ATTRIBUTE;
@property (strong, nonatomic, nullable) void(^willShowLeftView)(LGSideMenuController * _Nonnull sideMenuController, UIView * _Nonnull leftView);
@property (strong, nonatomic, nullable) void(^didShowLeftView)(LGSideMenuController * _Nonnull sideMenuController, UIView * _Nonnull leftView);
@property (strong, nonatomic, nullable) void(^willHideLeftView)(LGSideMenuController * _Nonnull sideMenuController, UIView * _Nonnull leftView);
@property (strong, nonatomic, nullable) void(^didHideLeftView)(LGSideMenuController * _Nonnull sideMenuController, UIView * _Nonnull leftView);
@property (strong, nonatomic, nullable) void(^willShowRightView)(LGSideMenuController * _Nonnull sideMenuController, UIView * _Nonnull rightView);
@property (strong, nonatomic, nullable) void(^didShowRightView)(LGSideMenuController * _Nonnull sideMenuController, UIView * _Nonnull rightView);
@property (strong, nonatomic, nullable) void(^willHideRightView)(LGSideMenuController * _Nonnull sideMenuController, UIView * _Nonnull rightView);
@property (strong, nonatomic, nullable) void(^didHideRightView)(LGSideMenuController * _Nonnull sideMenuController, UIView * _Nonnull rightView);
/** You can use this block to add some custom animations */
@property (strong, nonatomic, nullable) void(^showLeftViewAnimationsBlock)(LGSideMenuController * _Nonnull sideMenuController, UIView * _Nonnull leftView, NSTimeInterval duration);
/** You can use this block to add some custom animations */
@property (strong, nonatomic, nullable) void(^hideLeftViewAnimationsBlock)(LGSideMenuController * _Nonnull sideMenuController, UIView * _Nonnull leftView, NSTimeInterval duration);
/** You can use this block to add some custom animations */
@property (strong, nonatomic, nullable) void(^showRightViewAnimationsBlock)(LGSideMenuController * _Nonnull sideMenuController, UIView * _Nonnull rightView, NSTimeInterval duration);
/** You can use this block to add some custom animations */
@property (strong, nonatomic, nullable) void(^hideRightViewAnimationsBlock)(LGSideMenuController * _Nonnull sideMenuController, UIView * _Nonnull rightView, NSTimeInterval duration);
@protocol LGSideMenuControllerDelegate <NSObject>
@optional
- (void)willShowLeftView:(nonnull UIView *)leftView sideMenuController:(nonnull LGSideMenuController *)sideMenuController;
- (void)didShowLeftView:(nonnull UIView *)leftView sideMenuController:(nonnull LGSideMenuController *)sideMenuController;
- (void)willHideLeftView:(nonnull UIView *)leftView sideMenuController:(nonnull LGSideMenuController *)sideMenuController;
- (void)didHideLeftView:(nonnull UIView *)leftView sideMenuController:(nonnull LGSideMenuController *)sideMenuController;
- (void)willShowRightView:(nonnull UIView *)rightView sideMenuController:(nonnull LGSideMenuController *)sideMenuController;
- (void)didShowRightView:(nonnull UIView *)rightView sideMenuController:(nonnull LGSideMenuController *)sideMenuController;
- (void)willHideRightView:(nonnull UIView *)rightView sideMenuController:(nonnull LGSideMenuController *)sideMenuController;
- (void)didHideRightView:(nonnull UIView *)rightView sideMenuController:(nonnull LGSideMenuController *)sideMenuController;
/** You can use this method to add some custom animations */
- (void)showAnimationsBlockForLeftView:(nonnull UIView *)leftView sideMenuController:(nonnull LGSideMenuController *)sideMenuController duration:(NSTimeInterval)duration;
/** You can use this method to add some custom animations */
- (void)hideAnimationsBlockForLeftView:(nonnull UIView *)leftView sideMenuController:(nonnull LGSideMenuController *)sideMenuController duration:(NSTimeInterval)duration;
/** You can use this method to add some custom animations */
- (void)showAnimationsBlockForRightView:(nonnull UIView *)rightView sideMenuController:(nonnull LGSideMenuController *)sideMenuController duration:(NSTimeInterval)duration;
/** You can use this method to add some custom animations */
- (void)hideAnimationsBlockForRightView:(nonnull UIView *)rightView sideMenuController:(nonnull LGSideMenuController *)sideMenuController duration:(NSTimeInterval)duration;
@end