Swapping tableView into another view within UITableViewController

I'm trying to resize the tableview of a UITableViewController so I can also put some other content in the view. So I'm trying to swap the tableview into a new view. The following works, but if I try to reference self.tableview later, it returns null. What am I doing wrong ?

- (void)viewDidLoad {
    [super viewDidLoad];

    UIView *view = [[UIView alloc] initWithFrame:[UIScreen mainScreen].applicationFrame]; 
    self.tableView.frame = CGRectMake(0, 0, 320, 200);
    [view addSubview:self.tableView];
    self.view = view;
}

Yes, I can probably just use a UIViewController and create my tableview there. I was just trying to avoid doing that if I can, and get the freebies of UITableViewController


为了解决我刚才对tableView的问题,并覆盖了tableview getter

- (UITableView*)tableView{
    return myTableView;
}

- (void)viewDidLoad {
    [super viewDidLoad];
    myTableView = [super tableView];
    UIView *view = [[UIView alloc] initWithFrame:[UIScreen mainScreen].applicationFrame]; 
    self.view = view;
    myTableView.frame = CGRectMake(0, 0, 320, 200);
    [view addSubview:myTableView];
    }
链接地址: http://www.djcxy.com/p/84292.html

上一篇: 关于iPhone 3GS图像选择器控制器的问题

下一篇: 将tableView交换到UITableViewController中的另一个视图中