大佬教程收集整理的这篇文章主要介绍了ios – 在长按手势的UIButton中显示图像,大佬教程大佬觉得挺不错的,现在分享给大家,也给大家做个参考。
//set the button with the image of conference here. UIButton * button = [UIButton buttonWithType:UIButtonTypeCustom]; button.frame = CGRectMake(3,3,w-5,h-5); CALayer * l = [button layer]; [l setMasksToBounds:YES]; [l setCornerRadius:8.0]; [button setImage:thumb forState:UIControlStateNormal]; button.property = confInfo; [button addTarget:self action:@SELEctor(buttonClicked:) forControlEvents:UIControlEventTouchUpInside]; button.tag = i; bView.tag = i; //Add gesture recognizer to be used for deletion of conference. UILongPressGestureRecognizer *pahGestureRecognizer = [[UILongPressGestureRecognizer alloc] initWithTarget:self action:@SELEctor(longPressGestureRecognizerStateChanged:)]; pahGestureRecognizer.minimumPressDuration = 1.0; [button addGestureRecognizer:pahGestureRecognizer];
此代码处于循环中(请参阅代码中的i).我的长时间动作是这样的:
- (void)longPressGestureRecognizerStateChanged:(UIGestureRecognizer *)gestureRecognizer { switch (gestureRecognizer.statE) { case UIGestureRecognizerStateEnded: NSLog(@"Tapped!!!"); break; default: break; } }
如何通过我点击此操作的按钮来显示按钮右上角的较小X图像?
以上是大佬教程为你收集整理的ios – 在长按手势的UIButton中显示图像全部内容,希望文章能够帮你解决ios – 在长按手势的UIButton中显示图像所遇到的程序开发问题。
如果觉得大佬教程网站内容还不错,欢迎将大佬教程推荐给程序员好友。
本图文内容来源于网友网络收集整理提供,作为学习参考使用,版权属于原作者。
如您有任何意见或建议可联系处理。小编QQ:384754419,请注明来意。