Event from View on Window

Discussion in 'iOS Programming' started by bboyjayz, May 4, 2009.

  1. macrumors member

    Mar 20, 2009
    i've a problem, for my application, i want a view visible from all view which can appear during the game (yes my app is a game :) ), so, i've decided to put this view into the mainWindow... and it's work : the view appear all timeS... but their is a problem : if a clic on the view, it must open a url on safari, but it seems that a can't have an interaction with this view.... do you know how can i do ?
    thank you for your answers...
  2. macrumors regular

    Apr 9, 2009
    well, like every other view you want to have interactions with. you subclass UIViewController and then use
    -(void)touchesEnded:(NSSet *)touches withEvent:(UIEvent *)event

    or you use an IBAction and set it for "touch up inside" in that view.
  3. thread starter macrumors member

    Mar 20, 2009
    Yes but it's not me who controll the interaction (it's a view for a advertisement)... :s
  4. macrumors 6502


    Aug 15, 2008
    Manchester, UK
    You don't have to subclass UIViewController you can just subclass a UIView and override its touch methods

    And to the OP, is the view a custom view class made by the advertising company? If so then something simple like not setting the user interaction enabled could be the issue. If it is in fact a class of your own then you will most certainly need to override the touch methods as BlackWolf said.
  5. macrumors regular

    Apr 9, 2009
    yeah, but in my opinion you should always go with the controller classes if you have the chance to.
  6. thread starter macrumors member

    Mar 20, 2009
    Sorry i think i'm lost, yes, the advertisement company gave me a personal viewController, so i don't really know how to manipulate this .... :s

Share This Page