基于CMuneBar完成的兩側(cè)展開動(dòng)畫

首先,感謝原作者提供的CMuneBar這個(gè)demo 地址如下:https://github.com/CaoWeikang/CMuneBarDemo
原文提供了很多種效果,如扇形展開菜單,單側(cè)展開菜單等效果,都是基于貝塞爾曲線來做的,我今天要說的效果和demo里面的其中一種效果是類似的,不解釋,看圖:
demo里面的效果圖:

演示.gif

我要實(shí)現(xiàn)的效果是gif圖片中的第5中效果和第6中效果疊加到一起的效果,也就是兩邊都要展開,點(diǎn)擊中間的菜單按鈕如圖:

2016-07-22 15_37_17.gif

我在原文的基礎(chǔ)上加了一個(gè)旋轉(zhuǎn)的動(dòng)畫,具體你可以看下代碼,效果還是不錯(cuò)的,我的實(shí)現(xiàn)思路是添加兩個(gè)菜單按鈕,分別添加第5和第6種效果,代碼如下:

    CMuneBar *muneBar = [[CMuneBar alloc] initWithItems:@[@"camera",@"draw"] size:CGSizeMake(50, 50) type:kMuneBarTypeLineLeft];
    muneBar.firstDelegate = self;
    muneBar.center = self.view.center;
    [self.view addSubview:muneBar];
    self.muneBar = muneBar;
    
    
    CMuneBar *secondMuneBar = [[CMuneBar alloc] initWithItems:@[@"gallery",@"dropbox"] size:CGSizeMake(50, 50) type:kMuneBarTypeLineRight];
    secondMuneBar.delegate = self;
    secondMuneBar.center = self.view.center;
    [self.view addSubview:secondMuneBar];
    self.secondMuneBar = secondMuneBar;
/**
 *  右邊item點(diǎn)擊代理事件
 *
 *  @param index 索引
 */
-(void)muneBarselected:(NSInteger)index{
    NSLog(@"%@",@(index));
}

- (void)muneBarShow {
    [self.muneBar showItems];
    NSLog(@"展開");
}

- (void)muneBarHide {
    NSLog(@"顯示");
}

/**
 *  左邊item點(diǎn)擊代理事件
 *
 *  @param index 索引
 */- (void)firstMuneBarselected:(NSInteger)index {
    NSLog(@"%@",@(index));
}

具體的代碼和詳情大家看代碼吧,畢竟是根據(jù)別人的demo來改寫的,具體如何使用大家也可以參考上面我給出的地址

最后編輯于
?著作權(quán)歸作者所有,轉(zhuǎn)載或內(nèi)容合作請(qǐng)聯(lián)系作者
【社區(qū)內(nèi)容提示】社區(qū)部分內(nèi)容疑似由AI輔助生成,瀏覽時(shí)請(qǐng)結(jié)合常識(shí)與多方信息審慎甄別。
平臺(tái)聲明:文章內(nèi)容(如有圖片或視頻亦包括在內(nèi))由作者上傳并發(fā)布,文章內(nèi)容僅代表作者本人觀點(diǎn),簡書系信息發(fā)布平臺(tái),僅提供信息存儲(chǔ)服務(wù)。

相關(guān)閱讀更多精彩內(nèi)容

友情鏈接更多精彩內(nèi)容