01 | - ( BOOL ) rect:(CGRect) rect collisionWithRect:(CGRect) rectTwo |
02 | { |
03 | float rect_x1 = rect.origin.x; |
04 | float rect_x2 = rect_x1+rect.size.width; |
05 | |
06 | float rect_y1 = rect.origin.y; |
07 | float rect_y2 = rect_y1+rect.size.height; |
08 | |
09 | float rect2_x1 = rectTwo.origin.x; |
10 | float rect2_x2 = rect2_x1+rectTwo.size.width; |
11 | |
12 | float rect2_y1 = rectTwo.origin.y; |
13 | float rect2_y2 = rect2_y1+rectTwo.size.height; |
14 | |
15 | if ((rect_x2 > rect2_x1 && rect_x1 <> rect2_y1 && rect_y1 <> |
16 | return YES; |
17 | |
18 | return NO; |
19 | } |
0 Comments