-->

2014年10月6日月曜日

JASidePanelControllerでサイドパネルを開くたびに呼ばれるメソッド

JASidePanelControllerを使ってみて、サイドパネルを開くたびにビューを更新しようと思ったけど、デフォルトでその機能がないみたいなのでメモ

JASidePanelController.hに
- (void)prepareShowRightPanel;
を追記

JASidePanelController.mで
- (void)_showRightPanel:(BOOL)animated bounce:(BOOL)shouldBounce {
    self.state = JASidePanelRightVisible;
    [self _loadRightPanel];
    
    [self _adjustCenterFrame];
    
    if (animated) {
        [self _animateCenterPanel:shouldBounce completion:nil];
    } else {
        self.centerPanelContainer.frame = _centerPanelRestingFrame; 
        [self styleContainer:self.centerPanelContainer animate:NO duration:0.0f];
        if (self.style == JASidePanelMultipleActive || self.pushesSidePanels) {
            [self _layoutSideContainers:NO duration:0.0f];
        }
    }
    
    if (self.style == JASidePanelSingleActive) {
        self.tapView = [[UIView alloc] init];
    }
    [self prepareShowRightPanel];//これを追加
    [self _toggleScrollsToTopForCenter:NO left:NO right:YES];
}
次に、JASidePanelControllerのサブクラスに
- (void)prepareShowRightPanel {
    NSLog(@"show right panel");
}
を記述

これで、右のサイドパネルを開くたびに
show right panel
とログが表示される

0 件のコメント:

コメントを投稿