/JHViewCorner

Set view's corner with one code! 图片圆角,圆角,圆角遮罩,遮罩,心形,心形遮罩

Primary LanguageObjective-CMIT LicenseMIT

JHViewCorner

Set view's corner with one code!

  • 1 行代码设置圆角

Version

Latest release version:


Cocoapods

pod "JHViewCorner"


What

image

image


Usage

// corner
[_imageView jh_setCornerRadius:H*0.5
                         color:self.superview.backgroundColor
                    rectCorner:UIRectCornerAllCorners
              highlightedColor:nil];

// corner and border
[_imageView jh_setCornerRadius:H*0.5
                         color:self.superview.backgroundColor
                    rectCorner:UIRectCornerAllCorners
                    borderColor:borderColor 
                    borderWidth:width
              highlightedColor:nil];

// heart
[_imageView jh_setHeartMask:color 
           highlightedColor:highlightedColor];
           
// heart and border
[_imageView jh_setHeartMask:color 
                borderColor:borderColor 
                borderWidth:width 
           highlightedColor:highlightedColor];


Logs

2018-11-14

  • fix a small bugs.

2018-7-3

  • add property 'jh_maskViewArray'.

2018-6-19

  • remove property 'jh_heartBorderMaskView'.

2018-6-15

  • add heart border mask.

2018-5-25

  • add heart mask.

2018-5-8

  • update.

2018-5-7

  • upload.

Notice

If you use it in "UITableViewCell"

you should override the blow methods:


// you have a image like this:
[_image1 jh_setCornerRadius:H*0.5
                      color:self.contentView.backgroundColor
                 rectCorner:UIRectCornerAllCorners
           highlightedColor:UIColorFromRGB(0xd9d9d9)];

- (void)setSelected:(BOOL)selected animated:(BOOL)animated {
    [super setSelected:selected animated:animated];

    _image1.jh_highlightedMaskView.hidden = !selected;
}

- (void)setHighlighted:(BOOL)highlighted animated:(BOOL)animated{
    [super setHighlighted:highlighted animated:animated];

    _image1.jh_highlightedMaskView.hidden = !highlighted;
}


GIF

Can reach 60FPS!

image


More

CGPathDrawingMode

image

BorderColor & BorderWidth

image

More Details

Not Good!🤔

image

Not Good!🤔

image

Not Good!🤔

image

Good!👍👍👍

image