Hiding touched area in UIView

Discussion in 'iOS Development' started by johnmabassa, Sep 14, 2010.

  1. johnmabassa

    johnmabassa Member

    Joined:
    Mar 16, 2009
    Messages:
    87
    Likes Received:
    0
    Hi,

    Is there a way to set visibility to 0 for only the portion that you have touched in the view?.

    Say I have a view with say complete black color and I am touching the center of the view and in my touches began method I will calculated an area. Now how can i set the visibility of that area only to zero?

    -john
  2. johnmabassa

    johnmabassa Member

    Joined:
    Mar 16, 2009
    Messages:
    87
    Likes Received:
    0
    Hi,

    Is this something possible or is it super simple?

    Please Register or Log in to view images

    I googled it but could not get any idea.

    Please Register or Log in to view images



    -john
  3. SkylarEC

    SkylarEC Super Moderator Emeritus Staff Member

    Joined:
    Sep 19, 2007
    Messages:
    6,642
    Likes Received:
    129
    You'd be correct. This is both possible and super simple. In fact, it is exactly as easy as drawing a view.

    Redraw the view's layer, making sure to cut out the touched area.

    Take a look at this simply connect4 game I started but never finished. http://github.com/SkylarEC/ConnectSome There is a section with UITables that mimick the table behavior of the UITables seen in Spotlight, Weather, Sticks, adn various other Apple applications that show the easiest way to manipulate a view's layer. Alternatively, the actual drawing of the game board is done using a layer with a configurable number of cutouts that show a much more customizable way to manipulate layers.

Share This Page