首先,感謝原作者提供的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來改寫的,具體如何使用大家也可以參考上面我給出的地址