mono touch中touch触发对象判断
来源:互联网 发布:数据的统计分析 编辑:程序博客网 时间:2024/05/19 21:58
先看一段代码:
public override void TouchesBegan (NSSet touches, UIEvent evt)
{
base.TouchesBegan (touches, evt);
UITouch touch = touches.AnyObject as UITouch;
if (touch != null) {
PointF pt = touch.LocationInView (this);
if (_path.ContainsPoint (pt, true)) {
Title = "You touched the square";
} else {
Title = "You didn't touch the square";
}
}
}
粗体红色部分是我们的待触发对象(派生至NSOjbect对象),如果当前触发的点(point)是在我们的目标对象内部就表明接触对象。除此之外还定义了几个虚函数用来处理
触碰事件:
public class UIResponder :NSObject
{
//...
public virtual void TouchesBegan (NSSet touches, UIEvent evt);
public virtual void TouchesMoved (NSSet touches, UIEvent evt);
public virtual void TouchesEnded (NSSet touches, UIEvent evt);
public virtual void TouchesCancelled (NSSet touches, UIEvent evt);
//...
}
public override void TouchesBegan (NSSet touches, UIEvent evt){base.TouchesBegan (touches, evt);UITouch touch = touches.AnyObject as UITouch;if (touch != null) {if (_img.Frame.Contains (touch.LocationInView (View))) {Tools.Alert ("yes");}}}
- mono touch中touch触发对象判断
- mono touch中自定义事件
- mono touch 中图片的StretchableImage属性
- mono touch中UIProgressView的使用
- mono touch中UISwitch控件的使用
- mono touch中UISegmentedControl控件的使用
- mono touch中,UISlider控件的使用
- mono touch中处理json字符串
- mono touch中重置UITableView选中行
- Mono Touch Table应用
- mono touch登录设计
- Mono Touch文件下载
- mono touch:Displaying Images
- mono touch :Displaying Alerts
- mono touch: Appearance API
- mono touch隐藏键盘
- mono touch 隐藏键盘
- mono touch中去掉NavigationBar的底部阴影
- 数据读取之逻辑读简单解析--关于BUFFER CACHE
- 心痛的时候抱抱自己
- 1039:词组缩写
- 获取Multipatch图层中模型的底面图形和模型的高度
- 神马是敏捷?(4)——敏捷不能当饭吃
- mono touch中touch触发对象判断
- C#中去掉Toolstrip边框的方法
- Spring3 MVC 笔记(二) —json+rest优化
- 顺序表的实现
- 【cocos2d-x IOS游戏开发-捕鱼达人2】cocos2d-x简介与开发环境搭建
- css控制大幻灯绝对居中(非背景)
- 献给北漂一族
- 数据库复制技术全面了解
- According to TLD or attribute directive in tag file, attribute value does not accept any expressions