views:

260

answers:

1

Hi guys.

I've coded a "generic" ads management class for all my applications and i have an issue. This class can add an ads view to any view of my application, randomly; in order to do so, my idea is to resize the frame of my current view to reduce its height (let's say 50 pixels less) and add my ads view in the free space i created. This way, i don't have to bother modifying my views for ads integrations, everything is done automatically. It's working well but my ads aren't responding to touch events. I guess it's because this ads view is "outside" the frame of my controller.

It is possible to reduce the height of my view frame and raise its bounds so my ads subview is really part of my view?

Thanks a lot :)

UIView *adView = [[UIView alloc] init];
adView.frame = CGRectMake(0,267,320,100);
adView.backgroundColor = [UIColor grayColor];
adView.tag = 123456;
adView.userInteractionEnabled = YES;
CGRect myFrame = [self.view frame];
myFrame.size.height = myFrame.size.height - 100;
[self.view setFrame:myFrame];
[self.view addSubview:adView];

Here's a picture representing what i would like to do : http://i49.tinypic.com/2iw7lz4.jpg

A: 

This is not an answer but I do not have option to post a comment to your question.

Can you please post the code you have in your touchesBegan method?

I think there can be the problem

Regards

Alejandra

Alejandra Gonzalez
I don't have any touchesBegan method implemented. My ads view only contains a UIButton with a target.
Vivi
What i can recommend is to create a view that covers the 320 x 480 and attach your controller to that view. Then add the view you are resizing and the buttons in the free space. The controller attached to the big view is going to respond to the events in the buttons. I Think that can work, I hope that helps :) Regards Alejandra
Alejandra Gonzalez
Thanks for the tip but that's not exactly what i am looking for. Since i want the ads management process to be independant of the application, i don't want to change the view hierarchy :S
Vivi
I gave up : what i did is that i created each views inside a main view and i programmatically resized subviews when i had an Ad to show.
Vivi