moveshow-监听手指位置趣味小程序
来源:互联网 发布:golang 1.7.4 编辑:程序博客网 时间:2024/04/29 06:07
@interface ViewController : UIViewController
{
CGPoint beginPoint;
CGPoint nowPoint;
BOOL isInButton;
}
@property (strong,nonatomic) IBOutlet UIButton *mButton;
- (void)viewDidLoad
{
[super viewDidLoad];
isInButton = YES;
// Do any additional setup after loading the view, typically from a nib.
}
- (IBAction)buttonclick:(id)sender
{
NSLog(@"button tap");
}
- (void)shownslog
{
if (isInButton) {
[mButton setBackgroundImage:[UIImage imageNamed:@"meinv.jpg"] forState:UIControlStateNormal];
NSLog(@"move in button");
}else{
[mButton setBackgroundImage:[UIImage imageNamed:@"images.jpeg"] forState:UIControlStateNormal];
NSLog(@"move out button");
}
}
- (void)touchesBegan:(NSSet *)touches withEvent:(UIEvent *)event
{
UITouch *touch = [touches anyObject];
beginPoint = [touch locationInView:self.view];
}
- (void)touchesMoved:(NSSet *)touches withEvent:(UIEvent *)event
{
UITouch *touch = [touches anyObject];
nowPoint = [touch locationInView:self.view];
if (nowPoint.x <314&&nowPoint.x>6&&nowPoint.y>90&&nowPoint.y<313) {
if (!isInButton) {
isInButton = YES;
[self shownslog];
}
}
else
{
if (isInButton) {
isInButton = NO;
[self shownslog];
}
}
}
- (void)touchesCancelled:(NSSet *)touches withEvent:(UIEvent *)event
{
}
- (void)touchesEnded:(NSSet *)touches withEvent:(UIEvent *)event
{
if (isInButton) {
isInButton = NO;
[self shownslog];
}
}
- moveshow-监听手指位置趣味小程序
- 趣味小程序
- C语言趣味小程序:打印自身
- Java趣味小程序:打弹珠
- 小程序密钥位置
- Android小程序开发--跟随手指动的绿色小球
- 线程监听文件小程序
- C#趣味小程序(6)——动态工具栏
- IOS 页面手指滑动监听--
- 趣味程序之趣味系列
- 每日一个C++小程序【趣味篇】--C++绘画小程序
- 小趣味题
- 多线程趣味小题
- 趣味小知识
- ORACLE配置非默认位置的监听程序
- 相同位置字符串比较小程序
- Activity实现监听手指上下左右滑动
- Android 监听手指滑动,Toolbar颜色渐变
- hex字符串转换成char*类型代码
- C++第4次作业 输出图形
- java单例模式详解[转载]
- 2013年01月06日
- Android设置颜色的几种方法
- moveshow-监听手指位置趣味小程序
- 保存好的博客地址
- ios6.0横竖屏切换问题解决
- 十二.shell编程之条件判断与流程控制
- 如何让iOS应用程序访问到 dev下的设备
- 2012年年度工作总结报告[原创]
- Android中常用的5大布局[转]
- Android TextView控件属性列表
- android开发 -为TextView加上边框