PDA

View Full Version : Event from View on Window




bboyjayz
May 4, 2009, 02:56 AM
Hi,
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...



BlackWolf
May 4, 2009, 05:25 AM
Hi,
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...

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.

bboyjayz
May 4, 2009, 05:36 AM
Yes but it's not me who controll the interaction (it's a view for a advertisement)... :s

mccannmarc
May 4, 2009, 05:37 AM
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.

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.

BlackWolf
May 4, 2009, 06:28 AM
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.

yeah, but in my opinion you should always go with the controller classes if you have the chance to.

bboyjayz
May 4, 2009, 07:04 AM
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