iPhone UITableView PlainStyle with custom background image - done “entirely” in code

后端 未结 5 973
情深已故
情深已故 2021-02-09 08:28

I have been all over the place, seems the UITableView with a static background issue is well documented, but no one with a straight forward solution? Im building my

5条回答
  •  自闭症患者
    2021-02-09 08:49

    Ok, now it is running:) My tableView was not populated with my cells, so breakPointing through the thing I found out that even though I had implemented the TableViewDataSource and TableViewDelegate, this was only in the main view, I needed to set the delegate and datasource of the tableview to = self. For others seeking an answer to this here is the method as it ended up with Coneybeares help:

    - (void)loadView {
    [super loadView];
    
    UIImageView *imageView = [[[UIImageView alloc] initWithFrame:self.view.bounds] autorelease];
    [imageView setImage:[UIImage imageNamed:@"carbon_background.png"]];
    [self.view addSubview:imageView];
    
    [self.tableView = [[UITableView alloc] initWithFrame:self.view.bounds] autorelease];
    [self.tableView setBackgroundColor:[UIColor clearColor]];
    [self.view addSubview:self.tableView];
    
    self.tableView.delegate = self;
    self.tableView.dataSource = self;
    

    }

提交回复
热议问题