基于CMuneBar完成的兩側展開動畫
原文提供了很多種效果,如扇形展開菜單,單側展開菜單等效果,都是基于貝塞爾曲線來做的,我今天要說的效果和demo里面的其中一種效果是類似的,不解釋,看圖:
demo里面的效果圖:
演示.gif
我要實現的效果是gif圖片中的第5中效果和第6中效果疊加到一起的效果,也就是兩邊都要展開,點擊中間的菜單按鈕如圖:
2016-07-22 15_37_17.gif
我在原文的基礎上加了一個旋轉的動畫,具體你可以看下代碼,效果還是不錯的,我的實現思路是添加兩個菜單按鈕,分別添加第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點擊代理事件
*
* @param index 索引
*/
-(void)muneBarselected:(NSInteger)index{
NSLog(@"%@",@(index));
}
- (void)muneBarShow {
[self.muneBar showItems];
NSLog(@"展開");
}
- (void)muneBarHide {
NSLog(@"顯示");
}
/**
* 左邊item點擊代理事件
*
* @param index 索引
*/- (void)firstMuneBarselected:(NSInteger)index {
NSLog(@"%@",@(index));
}
來自:http://www.jianshu.com/p/41d27463c3ef
本文由用戶 rqrf7853 自行上傳分享,僅供網友學習交流。所有權歸原作者,若您的權利被侵害,請聯系管理員。
轉載本站原創文章,請注明出處,并保留原始鏈接、圖片水印。
本站是一個以用戶分享為主的開源技術平臺,歡迎各類分享!