IOS 重载UIControl控件

class CustomControl:UIControl {
override func sendAction(action:Selector, to target:AnyObject?, forEvent event:UIEvent?) {
super.sendAction(action, to:target, forEvent:event)
}
}
self.customControl = CustomControl(frame:CGRectMake(100,100,100,100))
self.customControl.backgroundColor =UIColor.redColor()
self.customControl.addTarget(self, action:Selector(“touchUpInside”),forControlEvents:UIControlEvents.TouchUpInside)
self.view.addSubview(self.customControl)

©著作权归作者所有,转载或内容合作请联系作者
【社区内容提示】社区部分内容疑似由AI辅助生成,浏览时请结合常识与多方信息审慎甄别。
平台声明:文章内容(如有图片或视频亦包括在内)由作者上传并发布,文章内容仅代表作者本人观点,简书系信息发布平台,仅提供信息存储服务。

相关阅读更多精彩内容

  • 我们在开发应用的时候,经常会用到各种各样的控件,诸如按钮(UIButton)、滑块(UISlider)、分页控件(...
    傻傻小萝卜阅读 3,978评论 0 1
  • 目录主要分为以下几个样式:常用、会用、了解 目录 UIControl Target-Action机制Action的...
    kirito_song阅读 4,669评论 2 7
  • 重点参考链接: View Programming Guide for iOS https://developer....
    Kevin_Junbaozi阅读 10,056评论 0 15
  • 目录 1.用什么方式判断gif/png图片的? 取出图片数据的第一个字节, 就可以判断出图片的真实类型 使用方法 ...
    勇敢的_心_阅读 4,342评论 0 2
  • 姓名:徐芳芳 公司:南京凯弘进出口贸易有限公司 349期努力二组【日精进打卡第67天】 【知~学习】 《六项精进》...
    徐芳芳_4548阅读 708评论 0 0

友情链接更多精彩内容