自定义UIView添加点击效果
2014-03-24 16:02
288 查看
// // UIViewLinkmanTouch.h // // 自定义UIView,用来改变点击背景颜色 #import <UIKit/UIKit.h> @interface UIViewLinkmanTouch : UIView - (void)touchesBegan:(NSSet *)touches withEvent:(UIEvent *)event; - (void)touchesEnded:(NSSet *)touches withEvent:(UIEvent *)event; - (void)touchesCancelled:(NSSet *)touches withEvent:(UIEvent *)event; @end
// // UIViewLinkmanTouch.m // #import "UIViewLinkmanTouch.h" @implementation UIViewLinkmanTouch - (void)touchesBegan:(NSSet *)touches withEvent:(UIEvent *)event { [super touchesBegan:touches withEvent:event]; [self setBackgroundColor:[UIColor colorWithRed:227/255.0 green:227/255.0 blue:227/255.0 alpha:1.0]]; } - (void)touchesEnded:(NSSet *)touches withEvent:(UIEvent *)event { [super touchesEnded:touches withEvent:event]; [self setBackgroundColor:[UIColor colorWithRed:255/255.0 green:255/255.0 blue:255/255.0 alpha:1.0]]; } - (void)touchesCancelled:(NSSet *)touches withEvent:(UIEvent *)event { [super touchesCancelled:touches withEvent:event]; [self setBackgroundColor:[UIColor colorWithRed:255/255.0 green:255/255.0 blue:255/255.0 alpha:1.0]]; } @end
相关文章推荐
- iOS中给自定义tabBar的按钮添加点击放大缩小的动画效果
- 自定义View之自定义按键圆角边框背景添加点击效果
- 【Swift 2.1】为 UIView 添加点击事件和点击效果
- IOS 自定义UIBUTTON 直接拖个xib 就能在button上显示多行文本 并且添加了点击的效果
- IOS 自定义UIBUTTON 直接拖个xib 就能在button上显示多行文本 并且添加了点击的效果
- Swift 2.1 为 UIView 添加点击事件和点击效果
- js的自定义属性及多一排图片的点击切换效果的实现
- 添加UIview自定义的分割线、去掉默认的cell分割线、默认选中某一个(行)cell的方法
- 源码推荐(8.17):闪屏效果,简易动画引擎,iOS UIView自定义四个边角的圆角
- Android中的Button自定义点击效果
- 使用XIB自定义一个UIView,然后将这个view添加到controller的view
- 自定义tab,下边是viewpager。滑动viewpager,tab跟着动,点击tab,有动画效果并且viewpager也动。
- TextView实现超链接并自定义点击效果
- Android中自定义ImageView添加文字设置按下效果详解
- 安卓自定义EditText控件,在短信或邮件群发界面,添加联系人的效果
- 安卓基础--自定义无限轮播的轮播图,可动态添加指示点,可点击跳转页面
- Button多样化与自定义点击效果
- iOS View添加手势,防止View上点击其他视图触发点击效果
- IOS开发(19)IOS 自定义UIView实现请求等待控件(模态效果)
- 自定义viewGroup实现点击动画效果