I have a TableView as a subview of an UIViewController, presented modally. The TableView has a clear background. When I set the cells background to white, cells appears transparent but when color is set to Red everything is ok.
What's going on ?
Related
I have a UITableViewCell that has a UIImageView 20 pts in from the left. When I tap "Edit" to edit the contents of my UITableView and the red edit circle comes in from the left, how do I properly set up my constraints so the left of my UIImageView is constrained to the right of that red edit circle view?
Note: I'm doing layout in code, not using Storyboards or xibs
This would be handled automatically if you make sure that your views are subviews of the contentView in the UITableViewCell and your constraints are applied to the contentView.
I have done a fair bit of googling on this and I can't find the right solution. I have a UITableView of which I want to change the colour of the background of the cells. I have found solutions to doing this but it only deals with cells which have content or data as it were.
I need to colour the background of those unused cells as well.
Try setting the background colour of the tableView itself. Those "empty cells" at the bottom aren't really cells at all - they're just separator lines drawn over the background.
Even though UITableViewCell inherits from UIView, changing the backgroundColor property of the cell itself won't do anything. You need to change the background color of the cell's contentView, such as
cell.contentView.backgroundColor = [UIColor greenColor];
This is because the subviews of a UITableViewCell are actually subviews of the cell's contentView, because the contentView knows how to resize its subviews if a cell is put into editing mode; the cell itself doesn't know how to do that.
I'm not sure what you mean by unused cells. If you tell your tableView there are 10 cells and you only provide content for 8 of them, you'll still have 10 green cells, if that's what you mean by "unused".
I had a UITableView that I replaced with a UIPopoverController. My UITableView's background was set to clearColor and it showed the custom background through the table. The table cells also matched the grey tint of my background image.
Now when I use the UIPopovercontroller, with the background set to clearColor, I can see through my UIPopoverController, but the color is the "standard" popover controller color. The kind of grey/blue tint. Is there a way to change that? Thanks.
I have a UITableView and I would like it ho have the same effect when scrolling as the picture. (Shadow below UINavigationBar and above of UITableView)
How can I do this?:
You can create a view on the top of the uitable with a custom background.
See this related question: Light gray background in "bounce area" of a UITableView
In your case you could have an image instead of a solid color.
I have a UITableView which displays about 5 cells at a time, yet in my table there might be cases where there are only 2 cells with content as seen on this picture:
alt text http://www.freeimagehosting.net/uploads/30d3602979.png
The white cells below do not look nice, how can I change the background color of these cells to black too? UITableView does not have a backgroundColor property.
Thanks!
A UITableView inherits from UIView, and UIView always has a backgroundColor.
You can also change the background color to "non-opaque", and then change the background color of your parent container.
tableView.backgroundColor = // some UIColor