简体   繁体   English

如何在iPhone上手动调用UIView的touch事件?

[英]How do I manually call a UIView's touch event on the iPhone?

How do I manually touch a UIView means programattically. 我如何以编程方式手动触摸UIView。

I want to touch a view inside a UIScrollView touch manually. 我想手动触摸UIScrollView touch内部的视图。

Any idea how to do this? 任何想法如何做到这一点?

Or how do I manually call UIScrollView's scrollViewWillBeginDecelerating? 或者如何手动调用UIScrollView的scrollViewWillBeginDecelerating?

This functionality is not intended to be used manually. 不应手动使用此功能。 You're better off adding a degree of indirection by adding a method. 您最好通过添加方法来添加一定程度的间接性。

Add a method that contains the functionality you want from the manual call 添加一个方法,该方法包含手动调用中所需的功能

(void)manualFunctionality {...}

Then include a call to that method in your implementation of the scrollViewWillBeginDecelerating method. 然后在对scrollViewWillBeginDecelerating方法的实现中包括scrollViewWillBeginDecelerating方法的scrollViewWillBeginDecelerating

This way, you are in accordance with the SDK's original intention and you can call your new method manually as much as you want. 这样,您就可以符合SDK的初衷,并且可以根据需要手动调用新方法。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM