Hey guys i want to make the background of my cell color to be like this
.check the attached image.
thanks
u have to use gradients to get this look.take a look at this tutorial (gradients part) http://www.raywenderlich.com/2033/core-graphics-101-lines-rectangles-and-gradients
INSIDE cellforrowind.... function
cell.contentView.backgroundColor = [UIColor clearColor];
cell.backgroundColor = [UIColor lightGrayColor];
or
[UIColor colorWithRed:(CGFloat)red green:(CGFloat)green blue:(CGFloat)blue alpha:(CGFloat)alpha];
change those value with red ,green blue ,alpha
Related
MyTableCell *cell=[[MyTableCell alloc]init];
cell.backgroundColor = [UIColor clearColor];
The above lines of code are still showing the white color of the cell's background and hiding the background image of the tableview.
Go to you storyboard and set the color of your uitableview cell to clear color from there.And also set uitabelview color also to clear color.
Or in you viewdidload set tableview background color to clear color and in cellforrow at indexparth delagate set
cell.contentView.backGroundColor = [UIColor ClearColor]
try this
- (void)tableView:(UITableView *)tableView willDisplayCell(UITableViewCell *)cellforRowAtIndexPath:(NSIndexPath *)indexPath
{
[cell setBackgroundColor:[UIColor clearColor]];
}
set the contentview background color also
cell.contentView.backGroundColor = [UIColor ClearColor];
cell.backGroundView.backGroundColor = [UIColor ClearColor];
cell.selectedBackGroundView.backGroundColor = [UIColor ClearColor];
Also check if you cleared the tableView.backGroundColor also
Thank you every one. I have solved the problem. I changed the background attribute in the attribute inspector in the storyboard for my cell object from default to clear color and it worked.
You can do it this way
cell.backgroundColor = [UIColor clearColor];
cell.backgroundView.backgroundColor = [UIColor clearColor];
How i can add specific colour in verticalSeperator UITable.I tried with UIColor option but its not working please help me to solve this.
HJTextFieldCell *cell = (HJTextFieldCell *)[_tableView dequeueReusableCellWithIdentifier:textCellIdentifier];
cell.constraint_leftSideOftxtFild.constant = 10.0f;
cell.constraint_heigntOfTxtField.constant = 30.0f;
cell.lbl_verticalSeprator.hidden =NO;
cell.lbl_verticalSeprator.textColor = [UIColor colorWithRed:0.0/255.0 green:0.0/255.0 blue:0.098/255.0 alpha:0.22];
Try with background color not text color.
cell.lbl_verticalSeprator.backgroundColor = [UIColor colorWithRed:0.0/255.0 green:0.0/255.0 blue:0.098/255.0 alpha:0.22];
and the best way is to use native separator and you can change the color with tableView.separatorColor of UITableview
I am setting the Background color of my uitableviewCell like
cell.contentView.backgroundColor = [UIColor colorWithRed:8.0 green:210.0 blue:11.0 alpha:1.0];
its not working, however, if i do like
cell.contentView.backgroundColor = [UIColor grayColor];
it works then. Any help
UIColor has to be defined between 0 and 1 to get the RGB value to work (UIColor class reference):
cell.contentView.backgroundColor = [UIColor colorWithRed:8.0f/255.0f green:210.0f/255.0f blue:11.0f/255.0f alpha:1.0f];
i have a problem in setting UITableViewCell background color. I wanna change it into my own color, so I use this code to change that background color :
UIView *bg = [[UIView alloc] init];
bg.backgroundColor = [ColorManager backgroundInput];
bg.layer.masksToBounds = YES;
[cell setSelectedBackgroundView:bg];
I implement this code in CellForRowAtIndexPath method.
The weird thing I have is, when i tap into a cell, the separator line color being highlight just like the image below. I just wanna make it still dark, anybody have idea?
Thank you
After setting up your own background view,which will have the line or not,
you can clear the default tableview color
tablename.separatorColor = [UIColor clearColor];
OR
If you don't want to remove the default line then you can give same color of background view to line color
//You can specify the RGB of background view
tablename.separatorColor = [UIColor colorWithRed:R green:G blue:B alpha:1.0f];
I think the best option is
[tableView setSeparatorStyle:UITableViewCellSeparatorStyleNone];
Another option is to set the backgroundColor of the UITableViewCell to a clear color.
cell.backgroundColor = [UIColor clearColor];
try it
Objective-c
tablename.separatorColor = [UIColor blackColor];
Swift
tablename.separatorColor = UIColor.blackColor();
I have to set the backgroundColor property of a UITableView to a certain color in my universal app. If I write this...
self.tableView.backgroundColor = [UIColor colorWithRed:146.0f green:197.0f blue:240.0f alpha:1.0f];
...it doesn't work on iPhone nor iPad (background results white).
If I use a standard color, instead...
self.tableView.backgroundColor = [UIColor greenColor];
...it works on iPhone but not on iPad.
I tried other solutions suggested on SO (backgroundView to nil/clearColor, etc.), but none of those works on iOS SDK 5. Can you help me?
You need to divide each color value to 255.
Your color will be:
[UIColor colorWithRed:146/255.0 green:197/255.0 blue:240/255.0 alpha:1.0];
Instead of changing the background color, you can set a backgroundView (with the background color that you like) for the tableView.
UIView *bgView = [[UIView alloc] initWithFrame:self.tableView.bounds];
bgView.backgroundColor = [UIColor redColor];
self.tableView.backgroundView = bgView;
Are you using a navigation controller?
Try this:
self.tableView.backgroundColor = [UIColor clearColor];
[self.tableView setSeparatorColor:[UIColor clearColor]];
self.navigationController.view.backgroundColor = [UIColor greenColor];
Thats what I use with iOS5 and an universal app.