Swift - UITableViewCell checkmark background color - uitableview

In method didSelectRowAtIndexPath I use
selectedCell.accessoryType = .Checkmark
How to change the background color of the checkmark to be different not Gray ?
and how to change the color of this:
This happens when I press the cell and didn't touch up the mouse button after I touch up it goes darker blue

The gray is because you have selected the cell. The selectionStyle defaults to a solid gray color, and you have not done anything to change that. If you don't like it, change it! The easiest approach, if you just want to change what happens during selection, is to provide a selectedBackgroundView with its own backgroundColor.

Related

how can I change tint color of only one row of a tableview cell

I have a table with times and I just want to highlight the line with the current date with a different text color (tint color - not the background color). Everything works so far - only the drawing color cannot be changed? The background color is used to highlight other information.
customCell.descriptionField.text = "\(entriesSection.events![indexPath.row].title!)"
customCell.descriptionField.tintColor = .blue /// ??? - it does not work!

UITableviewcell with UIbutton , changes tableview cell background color

I have added custom UITableViewCell with UIButton. On button click I have added popup but whenever I clicked on button then UITableViewCell background color will changed. I don't want to change the color. Also add UITableViewSelectionStyleNone.
Screenshot:
Set UITableViewCell.SelectionStyle to .none if using swift or
UITableViewCellSelectionStyleNone for Objective-C. Also try

How can I change the UIButton "glow" color used when "Shows Touch On Highlight" is enabled?

I have a UIButton with "Shows Touch On Highlight" enabled in the storyboard. It applies a "white" glow to the button when clicked.
However, I have a light grey button and would like to change the glow color so that it's more visible.
I've tried setting the background image for the highlighted control state to black, but it doesn't seem to make a different to the glow. I can change the background color of the button---that all works.
What controls the glow color, if anything? Or do I have to do it manually if I need a different color?
"Shows Touch On Highlight" is a pure convenience, so you do have to do things manually if you want a different effect. Just supply a different image for the highlighted state, one that includes the desired "glow" drawing.
Using a setBackgroundImage on the UIButton you can create a following extension that lets you to set a color for any state you want:
extension UIButton {
func setBackgroundColor(color: UIColor, for state: UIControlState) {
let image = UIImage.image(with: color)
let insets = UIEdgeInsetsMake(0, 0, 0, 0)
let stretchable = image.resizableImage(withCapInsets: insets, resizingMode: .tile)
self.setBackgroundImage(stretchable, for: state)
}
}
Than you just need to set a background color for the .highlighted state:
button.setBackgroundColor(color: UIColor.red, for: .highlighted)
I just hope you don't mind getting your hands dirty with code, I'm not really sure how to do the same from storyboards (I'm not even sure you can do it).

set color inside textfield near border

I want to change textfield color not background color but near part of textfield border just like shadow.
As shown in image.
If you want to add shadow in UITextField as you display in image then the easiest way will be that design image of that UITextField and set it to it UITextField background.
IT's so simple just slice that image and put that image in Textfield background. or Use the Code suggest by #Mrug.
textField.layer.cornerRadius=5.0f;
textField.layer.masksToBounds=YES;
textField.layer.borderColor=[[UIColor blackColor]CGColor];
textField.layer.borderWidth= 1.5f;

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