UITableView invisible checkmark - ios

I have a UITableViewController where a prototype cell named langCell is defined.
(see figure A)
Its accessory type is set to Checkmark which is supposed to be a blue checkmark appearing on the right side of the cell. (see figure B)
After having set this option, I did not see any "blue" checkmark appearing in the storyboard. I tried to change the background colour of the prototype cell to grey and the checkmark appeared back. (see figure C)
Why the default colour for checkmark is white? It is not visible.
How can I fix it?

You can show checkmark by two ways -
1) Set the cell's tintColor property as-
[cell setTintColor:[UIColor whiteColor]];
2) Set the accesoryView property of the cell to a UIImageView containing a checkmark of the correct color as-
UIImageView *checkMark = [[UIImageView alloc] initWithImage:[UIImage imageNamed:#"coloredCheckmark.png"]];
cell.accessoryView = checkMark;
[checkMark release];

Related

Editing tableview missing background color while editing on iPad

When I do tableView.setEditing(true, animated: true), cells indent and show the delete button as they're supposed to. However, on iPad, the places where the cell has indented, shows white instead of the background color i've set for the tableview, the cell and the view. This does not happen on iPhone
iPhone:
iPad:
What could be causing this bug?
Thanks in advance
You just require to set background color of the cell's content view to clearColor in -cellForRowAtIndexPath:
[cell.contentView setBackgroundColor:[UIColor clearColor]];
I think you are setting the color in the contentview. Use the cell itself. (UITableViewCells are UIViews)

Change checkMark color in ios7, Interface Builder

Description
I am developing an application, using tableViews and selecting properties by putting a checkmark for each of selected items. It drove me crazy for 2 hours, because the code was correct, but I didn't see checkmark.
Problem
Actually the checkmark was being loaded correctly but I didn't notice, because the background was white and also the checkmark.
What I want to do
I want to change the color of the checkmark (possibly in Interface Builder) without using custom CheckMarks with different images on it.
Is that possible? If not possible why I am having white checkMark while the other one in another tableView is gray?
It's not possible if you are using accessoryType on cell.
If you want to be really flexible better create custom view instead:
UIImageView* tick = (UIImageView*) [cell.contentView viewWithTag:1];
if(tick == nil)
{
tick = [[UIImageView alloc] initWithImage:[UIImage imageNamed:#"Archive"]];
[cell.contentView addSubview:tick];
tick.tag = 1;
tick.frame = CGRectMake(285.0f, 20.0f, tick.frame.size.width, tick.frame.size.height);
}
With that you can do whatever you like, use custom images, add background etc...
If you want code to look nicer it will be better if you extend UITableViewCell and create custom class with some methods and properties to control that. I just gave you code to a quick way to achieve what you want.

UITableVIew controller in completely black color

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.

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];

Set Grouped table view background colour

how can i set the background color of a grouped table view to clear color so that is get the image of the underlying Image View.
i tried to set the view color to clear view in the xib
it works fine in case of a normal table view
but doesnt work for a grouped table view
i also tried it programmatically but in vain
is there any work around
Check this code for clear the background color of grouped table view..
UIView *backView = [[UIView alloc] init];
[backView setBackgroundColor:[UIColor clearColor]];
[yourTableView setBackgroundView:backView];
Thanks..

Resources