开发之前,先确保你已经装好了CocoaPods,对于CocoaPods安装可能会报ruby的错误,具体看其数据源网站是否正常。把org换成com就行了。

Pods
Swift
target 'Your Target Name' do
pod "VHBoomMenuButton/Swift"
use_frameworks!
end
Objective C
target 'Your Target Name' do
pod "VHBoomMenuButton/ObjC"
use_frameworks!
end
在工程下面执行pod ini命令,然后用vim编辑Podfile文件,然后复制上述到你的工程,OC工程先2,Swift选1,然后直接在终端切换到工程目录下输入pod install,稍微耐心等到出现"Pod installation complete! There is 1 dependency from the Podfile and 1 total pod installed."字样,重新进入工程目录,用白色新的工程文件打开(蓝色图标是没用)
然后在选择工程的 Target -> Build Settings 菜单,找到User Header Search Paths设置项
新增一个值$(PODS_ROOT),并且选择recursive,这样xcode就会在项目目录中递归搜索文件。
使用:随意拖放一个UIView控件,Custom Class用VHBoomMenuButton,其它代码参照官方的例子。
效果图:
代码片
[_btn_bmb setNormalColor:[UIColor blackColor]];
[_btn_bmb setHighlightedColor:[UIColor blackColor]];
_btn_bmb.buttonEnum = VHButtonSimpleCircle;
_btn_bmb.piecePlaceEnum = VHPiecePlaceDOT_6_4;
_btn_bmb.buttonPlaceEnum = VHPiecePlaceDOT_6_4;
[_btn_bmb clearBuilders];
//CGFloat fSize = SCREEN_WIDTH / 3.8f;
CGFloat fSize = 83.9f;
for (int i = 0; i < _btn_bmb.pieceNumber; i++)
{
VHSimpleCircleButtonBuilder *builder = [VHSimpleCircleButtonBuilder builder];
[builder setImageSize:CGSizeMake(fSize, fSize)];
builder.normalImageName = [NSString stringWithFormat:@"mode_0%d_off",i+1];
[builder setPieceColor:[UIColor whiteColor]];
[builder setNormalColor:[UIColor clearColor]];
[builder setHighlightedColor:[UIColor clearColor]];
[_btn_bmb addBuilder:builder];
}
_btn_bmb.boomDelegate = self;
本文链接:https://it72.com:4443/12552.htm