开发者

How to determine click location coordinates in iphone app view class

开发者 https://www.devze.com 2023-01-23 19:32 出处:网络
i\'m trying to make a connect four iphone app. I have made my own custom UIView class, which is where the game is played. However, I am trying to use the touchesMoved, touchesEnded, etc. methods to re

i'm trying to make a connect four iphone app. I have made my own custom UIView class, which is where the game is played. However, I am trying to use the touchesMoved, touchesEnded, etc. methods to retrieve data based on where the user clicked (so i know which column they are trying to put a piece into). How开发者_JS百科 can i get this information from the viewController class to my UIview class?


I would just use - (BOOL)pointInside:(CGPoint)point withEvent:(UIEvent *)event and potentially override - (UIView *)hitTest:(CGPoint)point withEvent:(UIEvent *)event to ignore touches in views that I may have overlaid. It does depend on your view hierarchy really.

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号