Skip to content

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

License

Notifications You must be signed in to change notification settings

sszyc8/JHViewCorner

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

47 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

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

About

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

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages

  • Objective-C 97.9%
  • Ruby 2.1%