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

后端 未结 5 947
情深已故
情深已故 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:52

    All of this jumping through hoops is unnecessary if you're targeting > iOS 3.2, where you can use the new backgroundView property to set a UIImageView directly, e.g.:

    // In your UITableViewController subclass
    - (void)viewDidLoad
    {
        [super viewDidLoad];
    
        UIImageView *view = [[UIImageView alloc] initWithImage:[UIImage imageNamed:@"background.png"]];
        self.tableView.backgroundView = view;
    }  
    

提交回复
热议问题