Resolved Setting a background image

Discussion in 'iOS Programming' started by grandM, Sep 8, 2018.

  1. grandM, Sep 8, 2018
    Last edited: Sep 8, 2018

    grandM macrumors 6502a

    grandM

    Joined:
    Oct 14, 2013
    #1
    Hi everyone

    I have a static table view. I want to set the background using the instance property of UITableView. I've added a subclass of UITableViewController and set the class. I've added the following code:
    Code:
    override func viewDidLoad() {
    
            super.viewDidLoad()
    
          
    
          
    
            // Uncomment the following line to preserve selection between presentations
    
            // self.clearsSelectionOnViewWillAppear = false
    
    
    
            // Uncomment the following line to display an Edit button in the navigation bar for this view controller.
    
            // self.navigationItem.rightBarButtonItem = self.editButtonItem
    
            let imageView = UIImageView(image:  imageLiteral(resourceName: "key "))
    
            imageView.contentMode = .right
    
            imageView.alpha = 0.2
    
    //                imageView.frame = tableView.frame
    
    //        view.backgroundColor = UIColor(patternImage: #imageLiteral(resourceName: "key "))
    
            tableView.backgroundView = imageView
    
        }
    
    For some reason I cannot see the table view any longer. What am I doing wrong?
    Thanks for your answer
     

Share This Page