pointInside and hitTest

Discussion in 'iOS Development' started by deepp, Mar 25, 2009.

  1. deepp

    deepp New Member

    Joined:
    Sep 4, 2008
    Messages:
    73
    Likes Received:
    0
    Hi can any one help me with these two function...specially i want to know about pointInside method does it check the position of a view with regards another and checks if view1 is inside view2? just need to clear as i am trying to do that but not getting it work properly just let me know if my understanding is correct about this method...

    here i am trying to check if image1 is inside image2,for example i got image1 as ball and image2 as any arbitrary shape which covers the screen so want to check if ball is inside that image2 can i use pointInside method like this [image2 pointInside:ball.center withEvent:null]
  2. SkylarEC

    SkylarEC Super Moderator Emeritus Staff Member

    Joined:
    Sep 19, 2007
    Messages:
    6,642
    Likes Received:
    129
    pointInside:withEvent checks to see if a point is inside of a view.
    hitTest/hitTest:withEvent: is used to determine which object out of all the objects that contain the touched point should respond to the point.

    I am a fan of CGRectContainsPoint(CGRect rect, CGPoint point) which you can see in action in this tutorial: http://www.ifans.com/forums/showthread.php?t=135280
  3. deepp

    deepp New Member

    Joined:
    Sep 4, 2008
    Messages:
    73
    Likes Received:
    0
    Thanks skylar but then is it possible to check if i have 2 images like ball image and an ameoba image and if i want to check if balls been moving only on ameoba only and not on other image?please please reply...
  4. RaviKiran

    RaviKiran New Member

    Joined:
    Dec 19, 2011
    Messages:
    1
    Likes Received:
    0
    How to detect which image was touched

    Hi Skylar,

    I have a qusetion that suppose if i have 5 images in my view at different positions.How can i drag selected image to touch point.(without comparing [touch view] == imageview ).I want to do it dynamically.Please help


    Regards
    A.Ravi

    Please Register or Log in to view images

Share This Page