开发者

navigationController -- advertisement -- tableView in iPhone

开发者_运维技巧

I've already implemented an app that has navigationController at the very top, and it shows tableView at the first, and if it's cell is clicked, another view is pushed into the navigationController.

It's just an simple & normal app.

But I want to put an ad between the navigationBar and the tableView.

I've tried this and that. but it didn't work. Maybe there are several good ways to do it I believe.

Hope somebody point me a good tutorial or throw me ideas. thanks.


Maybe include more details about how your table view is being placed? Are you using a UITableViewController? If so, you can't easily add other views around it. It's better to use a vanilla UIViewController, and then you can lay out your ad and UITableView in Interface Builder, and hook them up to the view controller.


I would create a view that serves your ad, and set it as the header view on your tableView. For example, I have a UIView* outlet property called headerView on my UITableViewController subclass. In IB, I create the View for my header, and set it to the outlet. Then, on viewWillAppear, I set:

self.tableView.tableHeaderView = self.headerView;

This will let the ad scroll away with the table, which while possible getting less action on the ad will provide a better user experience for your app.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜