不规则按钮的添加,我这里使用的第三方插件OBShapedbutton,感谢Ole Begemann。
长按和短按的思路是:短按直接使用UIButton 的addtarge 方法,长按使用长按手势
上代码
UILongPressGestureRecognizer *longPress = [[UILongPressGestureRecognizer alloc] initWithTarget:self action:@selector(btnLong:)];
longPress.minimumPressDuration = 1; //定义按的时间
OBShapedButton *newButton = [[OBShapedButton alloc]initWithFrame:CGRectMake(200, 200.0, 100, 100)];
newButton.tag = 200;
[newB......
阅读全文