“`”
处理事件的方法
<ul>
<li>UIView是UIResponder的子类,可以覆盖下列4个方法处理不同的触摸事件</li>
</ul>
<pre><code class=""language-objectivec"" lang=""objectivec""> //一根或者多根手指开始触摸view
– (void)touchesBegan:(NSSet *)touches withEvent:(UIEvent *)event
//一根或者多根手指在view上移动
– (void)touchesMoved:(NSSet *)touches withEvent:(UIEvent *)event
//一根或者多根手指离开view
– (void)touchesEnded:(NSSet *)touches withEvent:(UIEvent *)event
//触摸结束前,某个系统事件(例如电话呼入)会打断触摸过程
– (void)touchesCancelled:(NSSet *)touches withEvent:(UIEvent *)event
</code></pre>
<pre><code> "“`
Was this helpful?
0 /
0