开发者

converting a UITableViewController to UITableView

The original version of my app contains a UITableViewController that is pushed onto the screen when it is called. In my updated versio开发者_运维技巧n, I have replaced that view with a regular UIViewcontroller that contains a tableView so that I can have a few graphics above the tableView, and it looks a lot better.

However, I'm having a lot of trouble declaring a new dataSource/Delegate for the tableView, and I was wondering if there was an easy way to use the old tableViewController as a dataSource/Delegate for the new tableView.


Should be able to just add it to the view like so:

UTTableView *tableview = [[UITableView alloc] initWithFrame:CGRectMake(0, 0, 320, 326) style:UITableViewStylePlain];
tableview.delegate = self;
tableview.dataSource = self;
[self.view addSubview:tableview];
[tableview release];

Everything else should just work... probably

edit: oh and make sure you implement the delegate calls in your header class:

@interface View: UIViewController <UITableViewDelegate, UITableViewDataSource>
0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜