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.
精彩评论