user1048042
user1048042

Reputation: 115

How to put AdWhirl-banner fixed above TabBar?

My app consists of a TabBar and several TableViews. I want to have the AdWhirl-banner fixed just above the TabBar (only in the first TableView), but thus far I have not been succeeding.

Until now, I have implemented the following code into my TableViewController:

AdWhirlView *adWhirlView = [AdWhirlView requestAdWhirlViewWithDelegate:self];
[self.tableView addSubview:adWhirlView];
adWhirlView.center = CGPointMake(160, 342);

And it indeed shows the Ad i want to see, only it is partly covered by a section header (from the TableView), and when scrolling the Ad scrolls along.

How can I achieve that the Ad is both on top (in terms of top view) and at a fixed spot (above the TabBar)?

Any help is greatly appreciated!

Upvotes: 1

Views: 969

Answers (3)

RajPara
RajPara

Reputation: 2281

I'd think another alternative here would be to have a container UIView that contains both a UITTabBar which contains a UITableView. If you're on the right tab, you could just request an ad. If the request is successful, just shrink the tabbed view enough to make room for the ad at the top and insert it into the container UIView.

Upvotes: 0

Darren
Darren

Reputation: 10398

You need to add it to the tabBar layer. Try this:

[self.tabBarController.view addSubview:adWhirlView];

You may need to reposition it do it's not underneath the tabbar. I also add a footer to the tables so they can be scrolled all the way up without the ad getting in the way.

Upvotes: 1

picciano
picciano

Reputation: 22711

You will likely need to create your own subclass of UIViewController, adding instances of both the AdWhirlView and UITableView to its view, either programatically, or in the nib file.

Anthoer, hackier way to do this would be to add the AdWhirlView as a header view in the existing table, but I'd opt for the first way. It will give you more control over how you want it to look and behave.

Upvotes: 0

Related Questions