UITableVIew controller in completely black color - ios

I have requirement to show UITableViewController in completely black color.
I am facing below problem:
I have set background color of cell as black color. I have only four entries so those four cells are in black color with White Colored text. But now other empty cells are also displayed and those are in white colors.

Give Your
self.view.backgroundColor = [UIColor blackColor];
And also give
self.myTableView.backgroundColor = [UIColor clearColor];
If you does not want to see separatorStyle of your UITableViewCell then also write following code.
self.myTableView.separatorStyle = UITableViewCellSeparatorStyleNone;
If you use All Of this code then you can see your UITableView Completely black.

Make the tableView background color as black and make the cell's background Color as clear color. It should work.

just set background color black color of your tableview from xib like
And make your cell background color clearColor.

[self.tableView setBackgroundColor:[UIColor blackColor]];

Remove extra empty cells from the tableview.
- (UIView *)tableView:(UITableView *)tableView viewForFooterInSection:(NSInteger)section
{
if ([self numberOfSectionsInTableView:tableView] == (section+1))
{
return [UIView new];
}
return nil;
}

You need to tableview background color black color.
[yourtableview setBackgroundColor:[UIColor blackColor]];
and remove cell background color means Clear color , it will work fine for You.

Related

UITableView background image for all cells

I want to change my tableview background image. When i change it, the change doesn't effect the cells. I'm using xib for my cells which doesn't have any code inside it, just design. So how can i solve this?
self.list.backgroundView = [[UIImageView alloc] initWithImage:
[UIImage imageNamed:#"Pattern.png"]];
In your cellForRowAtIndexPath method, set your cell's background color to clear color. It will make your cells transparent and show the background image.
Objective C:
cell.backgroundColor = [UIColor clearColor];
Swift:
cell.backgroundColor = UIColor.clearColor()

Why is the background of my table view grey when there are no rows?

Why is the background of my table view grey when there are no rows? I can't see where this is set in storyboard
Even setting the background to white explicitly I still get a grey background
Using the defaults for background also results in this grey background:
this might be due to two reason
a) you haven't set data source and delegate and your main view background color is gray
b) cell background color is gray, set that to clear color
Please add this code viewdidload or viewwillappear method
table.tableFooterView = [[UIView alloc] initWithFrame:CGRectZero];
For me it looks like it is a problem of the UITableViewCells, you should set them to
self.backgroundColor = [UIColor whiteColor]; // or clearColor
then also set the UITableView itself inside the controller to backgroundColor white or grey.
Also the snippet of #Rohitsuvagiya can help to let dissappear the separators if there is no additional UITableViewCell.
Please add line your code in viewdidload or viewillappear
table.backgroundColor=[UIColor clearColor];

UITableView background issue when upgrade iOS7

I am using UITableView without setting any background color but when I upgrade from iOS6 to iOS7 I found that UITableView misbehaves. The problem is its background color.
You need to set the tableview background color as below
tableView.backgroundView = nil;
tableView.backgroundColor = [UIColor redColor];
In iOS7 UITableView default background color is clearColor. So you can change it as following way by adding in viewDidLoad method :
self.tableView.backgroundColor = [UIColor yellowColor];
Here is the good reference
UITableViewCell show white background and cannot be modified on iOS7
Try to set its background color after the table view becomes visible.

table background clear - objective c - cocoa

Hi I want to display my table view without any background color so I used the following code to clear it
[uiTableView setBackgroundColor:[UIColor clearColor]];
This worked fine in the new iPad and also other generation iPads except it failed to work in iPad version one. The table shows with the background gray color. Is this something to do with iOS 5 ? Can anyone let me know if we can clear the background color in first version iPads.
I have noticed the same thing under iOS 5+. Try this:
[uiTableView setBackgroundColor:[UIColor clearColor]];
[uiTableView setBackgroundView:nil];
Should work as intended.
EDIT: If you're using the default cells, they cover the UITableView, so changing the UITableView's background color and view doesn't do anything. Try this in your tableView:cellForRowAtIndexPath: method:
cellName.backgroundColor = [UIColor clearColor];
cellName.backgroundView = nil;
As tableview has one more view as its background. You can set the backgroundColor in two ways.
i) Set the background color for the tableview and set the backgroundView to nil.
[uiTableView setBackgroundColor:[UIColor clearColor]];
[uiTableView setBackgroundView:nil];
ii) Set the backgroundColor for the tableView backgroundView.
UIColor *backgroundColor = [UIColor clearColor];
uiTableView.backgroundView = [[UIView alloc] initWithFrame:self.tableView.bounds];
uiTableView.backgroundView.backgroundColor = backgroundColor;

UITableViewCell text color gets changed on selection of row, why?

I have used UITableView with default UITableViewCell.
Here i have given dark gray color in cellForRowAtIndexPath method, also set one imageView to selectedBackgroundView.
So now when i select that row, particular selected image is getting displayed, but my textColor gets changed to White from Dark Gray.
Why so?
The UILabel is getting highlighted together with it's master view. Change it's highlightedTextColor, the default is white for you. For example
cell.textLabel.highlightedTextColor = [UIColor blackColor];

Resources