diff --git a/MVMCoreUI/Atoms/Views/LabelWithInternalButton.swift b/MVMCoreUI/Atoms/Views/LabelWithInternalButton.swift index 070cc0f7..c8484829 100644 --- a/MVMCoreUI/Atoms/Views/LabelWithInternalButton.swift +++ b/MVMCoreUI/Atoms/Views/LabelWithInternalButton.swift @@ -66,7 +66,7 @@ public typealias CoreObjectActionLoadPresentDelegate = MVMCoreActionDelegateProt } else { guard let label = label else { return } - let accessibleAction = UIAccessibilityCustomAction(name: actionText ?? "", target: label, selector: #selector(label.accessibilityCustomAction(_:))) + let accessibleAction = UIAccessibilityCustomAction(name: actionText ?? "label", target: label, selector: #selector(label.accessibilityCustomAction(_:))) label.clauses = [Label.ActionableClause(range: actionRange, actionBlock: newActionBlock, accessibilityID: accessibleAction.hash)] label.accessibilityCustomActions = [accessibleAction] diff --git a/MVMCoreUI/Containers/SplitViewController/MVMCoreUISplitViewController.h b/MVMCoreUI/Containers/SplitViewController/MVMCoreUISplitViewController.h index af02281d..1a72a190 100644 --- a/MVMCoreUI/Containers/SplitViewController/MVMCoreUISplitViewController.h +++ b/MVMCoreUI/Containers/SplitViewController/MVMCoreUISplitViewController.h @@ -24,8 +24,12 @@ typedef NS_ENUM(NSInteger, MFNumberOfDrawers) { @interface MVMCoreUISplitViewController : UIViewController // Reference to the panels. -@property (nullable, weak, nonatomic, readonly) UIViewController *leftPanel; -@property (nullable, weak, nonatomic, readonly) UIViewController *rightPanel; +@property (nullable, weak, nonatomic) UIViewController *leftPanel; +@property (nullable, weak, nonatomic) UIViewController *rightPanel; + +// For keeping +@property (nullable, strong, nonatomic) UIViewController *globalLeftPanel; +@property (nullable, strong, nonatomic) UIViewController *globalRightPanel; // Can be of protocol MVMCoreUIPanelButtonProtocol @property (nullable, strong, nonatomic) UIBarButtonItem *leftPanelButton; @@ -79,6 +83,9 @@ typedef NS_ENUM(NSInteger, MFNumberOfDrawers) { // contains speicaly logic to set the icon color - (void)setNavigationIconColor:(nullable UIColor *)color; +///create right and left panel. if left and right panel is already created, will replace them +- (void)createPanels; + /// Updates the panels that are used. - (void)setupPanels; diff --git a/MVMCoreUI/Containers/SplitViewController/MVMCoreUISplitViewController.m b/MVMCoreUI/Containers/SplitViewController/MVMCoreUISplitViewController.m index b5177b9b..93aeb6fd 100644 --- a/MVMCoreUI/Containers/SplitViewController/MVMCoreUISplitViewController.m +++ b/MVMCoreUI/Containers/SplitViewController/MVMCoreUISplitViewController.m @@ -44,12 +44,6 @@ typedef NS_OPTIONS(NSInteger, MFExtendedDrawer) { @property (weak, nonatomic) UIView *leftPanelSeparator; @property (weak, nonatomic) UIView *rightPanelSeparator; -// For keeping -@property (strong, nonatomic, readwrite) UIViewController *globalLeftPanel; -@property (strong, nonatomic, readwrite) UIViewController *globalRightPanel; - -@property (weak, nonatomic, readwrite) UIViewController *leftPanel; -@property (weak, nonatomic, readwrite) UIViewController *rightPanel; @property (weak, nonatomic, readwrite) NavigationController *navigationController; // A view that covers the detail view when the master is out. @@ -355,6 +349,9 @@ CGFloat const PanelAnimationDuration = 0.2; } - (void)showLeftPanelAnimated:(BOOL)animated explict:(BOOL)explict { + if (!self.leftPanel) { + return; + } [MVMCoreDispatchUtility performBlockOnMainThread:^{ if (self.mainViewLeading.constant < .1) { BOOL shouldExtendLeftPanel = [self shouldExtendLeftPanel]; @@ -548,6 +545,9 @@ CGFloat const PanelAnimationDuration = 0.2; } - (void)showRightPanelAnimated:(BOOL)animated explict:(BOOL)explict { + if (!self.rightPanel) { + return; + } [MVMCoreDispatchUtility performBlockOnMainThread:^{ if (self.mainViewTrailing.constant < .1) { BOOL shouldExtendRightPanel = [self shouldExtendRightPanel]; @@ -766,6 +766,13 @@ CGFloat const PanelAnimationDuration = 0.2; } } +- (void)createPanels { + // Create panels + self.globalLeftPanel = [self createLeftPanelViewController]; + self.globalRightPanel = [self createRightPanelViewController]; + [self setupPanels]; +} + - (void)setupPanels { [self forceHideBothDrawers]; [self setupLeftPanel]; @@ -862,10 +869,7 @@ CGFloat const PanelAnimationDuration = 0.2; [NSLayoutConstraint constraintWithItem:coverView attribute:NSLayoutAttributeTop relatedBy:NSLayoutRelationEqual toItem:mainView attribute:NSLayoutAttributeTop multiplier:1.0 constant:0].active = YES; [NSLayoutConstraint constraintWithItem:coverView attribute:NSLayoutAttributeBottom relatedBy:NSLayoutRelationEqual toItem:mainView attribute:NSLayoutAttributeBottom multiplier:1.0 constant:0].active = YES; - // Create panels - self.globalLeftPanel = [self createLeftPanelViewController]; - self.globalRightPanel = [self createRightPanelViewController]; - [self setupPanels]; + [self createPanels]; } - (void)viewDidLoad {