How to create gradient Shadow like below image(above green colour button): - ios

Please check this image and give me some example to draw this shadow above green button.

Related

UILabel border color with percentage

I want to color my UILabel border. But I want to do it part by part,, not the whole border. This is the thing that I want to do.
According to the percentage, I want to color my UILabel border.
How can I achieve this?
Create a custom subclass of UILabel.
In the initWithCoder method of your custom label, add 2 CAShapeLayer objects to your label.
Set one to draw in your dark blue and the other to draw in your light blue.
Install a CGPath in each one which is a full circle.
Manipulate the strokeStart and strokeEnd of each shape layer to draw the desired parts of each circle.

white text on white background image in swift

I've image and label over it. Images are of multiple color and I would like to add text label of white color. Is there anyway I can make the label text standout even if background image is white color?
I tried lowering alpha value for the background image, it gives little effect but label text not standing out clearly unless alpha value for background image is too low.
Set up your label field with a shadow on it.

how change a part of image color no the entire image

what I want to do is change only the black color of my original image to another color, and keep for example white color of my image
what I have tried is:
cell.iconeEcoute?.image = cell.iconeEcoute?.image!.imageWithRenderingMode(UIImageRenderingMode.AlwaysTemplate)
cell.iconeEcoute?.tintColor = colorHexIcone
But this code change the entire image color, and I want to keep green color and replace only black color in the image
any help would be appreciated
You can achieve it by taking separate View. Then give different color and alpha as you want. and you will see that part in different color.

draw an coloured rectangle in CPTAxisLabel (core-plot)

What I want is to draw a small rectangle inside an CPTAxisLabel to display a colour, what I have all ready tried is to draw a rectangle in a layer and add it as sublayer, but it stretches the small sublayer all over the label and the text isn`t visible anymore, I also tried to make an CPTLegend and add it to the label but I did not found any method to position it in the right side of the label, it just sits in the center, I tried changing the legends position, frame, bounds, padding and nothing. Does anyone know a better way of adding a rectangle shape in an CPTAxisLabel and also keep the text in the label ?
I assume you're using a CPTTextLayer for the label's contentLayer. Use an image fill on the text layer that contains your rectangle. Make it a stretchable image and set the stretchable area to the right of the rectangle. Set the paddingLeft on the text layer to leave room for the rectangle to the left of the label text.
After some long researches I found issue 266 in core-plot and it seems to be the problem I have with positioning a sublayer inside a CPTAxisLabel... I will keep waiting for a fix, but I don`t know if it will be solved soon.

UICollectionViewCell in Circular shape

Is it possible to create custom UICollectionViewCell in circular shape?
Why I need this?
I am trying to create custom color picker. I want to put some default color in each CollectionViewCell. These color are dynamic. That means I will be changing colors filled in cells.
What I have tried
1. I kept circle shaped png images in cells. But will have to change images if i want to change colors.
2. I kept circle shaped image transparent inside (in circle area). Then I changed Background color of cell. Failed as I will be changing Background image of collectionView.
3. I kept circle shaped image completely transparent except the boundary. Then I changed Background color of cell. Failed...
Help me..
Don't use a circular image. You can make any square view circular by adjusting the layer's cornerRadius property to half of the edge. So, if your cell is 100x100, set its corner radius to 50.
You can do this in your collection view data source (cellForItem...) or in the applyLayoutAttributes: method of your cell subclass.
For more flexibility use a CAShapeLayer added to the background view of the cell and change its fill colour. This way the coloured area can be any shape you like, and you can add shadow effects and animations to it.
this worked for me
if you need cell to be in circle remove thumbimageviewcell it the label which i m using and add your image view name
cell.thumbimageviewcell.layer.cornerRadius = cell.thumbimageviewcell.frame.size.width/2;
cell.thumbimageviewcell.layer.borderWidth = 2.0f;
cell.thumbimageviewcell.layer.borderColor = [UIColor whiteColor].CGColor;
cell.thumbimageviewcell.layer.masksToBounds = YES;

Resources