How to custom color selected cell? - ios

When a tableview cell is selected, the default gray color appears. I'd like to change this to something more transparent. Is there a way to do this to .selectionStyle?

You are looking for selectedBackgroundView. Make a UIView, give it transparent backgroundColor, and set it.

Related

How to set the background of a textView to a dark color and continue to see clearly the text selection?

I would like to set the colors for a textView to dark to avoid to stress the eyes when working on text.
If I set for example the field background to be black and the text to be white, the text color selection becomes a bit hard to see.
This is the code I'm using:
mainTextField.backgroundColor = UIColor.black
mainTextField.textColor = UIColor.white
Is there a way to have te selection of the text more visible?
I believe the text selection color is managed by the tintColor. You could set it to whatever you like by setting mainTextField.tintColor = UIColor.orange
UITextView text selection highlight color is determined by either the global or the view tint color.
You can set the color in Storyboard, by going to file inspector and setting the global tint color, or in attributes inspector of UITextView to apply it specifically for that view.
I also suggest that you set text color to Light Text Color.

Original UILabel for transparent view with opacity alpha 0.5

I have a CollectionView cell with labels, I want to make that view transparent with alpha 0.5 but not the UILabel's. I have a content view with clear background, and for the view above the content view, given with the background white with alpha value 0.5. The CollectionView is transparent but my problem is that the labels are also slightly transparent it's not much clear. please help me if anyone knows the solution.
You can achive this effect by putting your label into a view and then changing alpha component of view itself like this:
alphaView.backgroundColor = UIColor.blackColor().colorWithAlphaComponent(0.5)
Label shouldn't be transparent then. Ofc you need to set your label background color to clear.
You should not set the alpha value of the view. If you set the alpha value of a view this value takes effect on all subviews, too. You should set the alpha value of the background color of the view.
You should not set alpha value.
Instead you can set the background colour of the uicollectionviewcell to be clear colour. In this way your collection view cell will be transparent.
Then you could give whatever color to the labels.

Change the Tint Color of UITableView Multiple Selection Check Circles

When you enable allowsMultipleSelectionDuringEditing on a UITableView and then enter edit mode on it, each row will display a light grey circle on the left hand side. Upon tapping a row, the circle will be replaced with a tick icon, of the tint colour currently set to the table view.
I'm wondering, is there any way to override the tint colours of both of these icons and control them manually? I've discovered if you set cell.tintColor, you can override the tint colour of the icon when it's checked (But not the hollow circle graphic), but I'd rather be able to change the tint colour of just this icon.
I'm getting the sinking feeling the only way to do this is to manually hack the internal subviews, but I'm hoping someone may have found a way I've missed.
Setting the tintColor property of the cell should be enough.
e.g.
cell.tintColor = .green

UIView background color darker than UICollectionView background color

I set up a custom background color for UICollectionView using the Attributes inspector.
If I set up the same color for UIView using the Attributes inspector, the background color appears darker.
Could anybody give me a reason or even a solution for that?
I believe the solution is to set the same background color for the UICollectionViewCell using the Attributes inspector. The background of the cells seems to extend beyond the cell boundaries. If you need a different background for the cells you can fill the UICollectionViewCell with a UIImage and set the background of the UIImage to the color you want.

iOS UITableView Edit Mode Circle Border Color

I need to change the border color of the circles shown in a UITableView in edit mode. Currently it is shown in gray, but the circle can't be easily seen when there is a background behind the table.
I was able to update the Selected state using the tintColor property. But what I need is to change the color when the row is unselected.
You have to Create custom uitableviewcell in which you can set desired Image of check mark .

Resources