Reputation: 285
I want to show a login window items including userid/password and a few other cells info as tableView's cell in center of my first login screen in my app.
I use my appDelegate to present my TableViewController. Since I wanted to place tableView in center of whole screen and make it smaller than screen size, I changed the size of tableview in viewDidAppear() method by using "self.tableView.frame = smallerRect;" everything is fine but the color/contrast difference between the tableView region and the rest of the screen it is kinda ugly. Do you know what I have to do to make background color of tableView be the same as bg color of whole screen, that pretend the tableView covers entire screen but with smaller cell's widths?
Thanks,
Kam
Upvotes: 1
Views: 1630
Reputation: 285
UITableView has a property, backgroundView.
Made a UIView, set its backgroundColor to whatever I wanted, and then set the tableView's backgroundView property to that view.
Upvotes: 3
Reputation: 74
In your appDelegate, try setting self.window.backgroundColor to the color similar to your tableview's background color.
Upvotes: -1
Reputation: 14427
You don't do this with a TableViewController. What you need is a ViewController with a TableView added to it. Make sure to set the delegate and datasource to the VC class and include the required delegate and datasource methods and you should be good to go. About the only time I use a TableViewController versus a VC with a TV added is when I want to use a Static Cell TableView or am providing a view for a PopOverController In those cases a TVC is needed, all the other times you get much more freedom and flexibility by using a VC with a TV.
Upvotes: 0