Happy to meet the new product demand, full of joy to start work, the results of a study of the afternoon only to find that it is too simple for me to think, I am too naïve.
The demand is such a snow-like effect that randomly produces some small snowflakes, and then each snowflake can be clicked on to the next page.
After receiving the demand, my first idea is to use the button to achieve a short time, more simple things, the results of practice will know how ignorant of their own, in the mobile button at all there is no way to receive click events.
The colleague then gives a solution to get the click position through the gesture and then traverse the controls on the page if the click succeeds within that range. Through this idea I tried to use frame to achieve the requirements, and then found that I am an idiot, the page all the "snowflake" frame, is the end of the animation position, not real-time location.
But I feel the gesture, and then through the position, traverse, this idea should be right, so continue to Baidu, found a good thing
-(Calayer *) HitTest: (Cgpoint) p;
Through this can get this page to cover this point, so that you can solve my problem, the gesture is added to the "snowflake" on the parent page, and then click on the event to deal with (of course, there is no need to use this method must be a button)
-(void) Tapclick: (UITapGestureRecognizer *) tap{ cgpoint clickpoint = [tap locationinview:self]; For (Uiimageview *imageview in [self subviews]) { if ([ImageView.layer.presentationLayer hittest:clickpoint]) { //This button is hit whilst moving-do something with it here break ; } }}
This will solve the problem, of course, there should be other methods, welcome to add.
A link to help me with my problem-solving information
http://www.999dh.net/home.php?mod=space&uid=1&do=blog&id=410
Http://stackoverflow.com/questions/8346100/uibutton-cant-be-touched-while-animated-with-uiview-animatewithduration
IOS adds click events for UIView (UIButton) in the move