Skip to content

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

License

Notifications You must be signed in to change notification settings

xjh093/JHViewCorner

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

52 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

JHViewCorner

Set view's corner with one code!

  • 1 行代码设置圆角

Version

Latest version:

  • master branch

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

2023-4-13

  • fix bug in iOS16.

2020-09-15

  • fix a small bugs.

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! 图片圆角,圆角,圆角遮罩,遮罩,心形,心形遮罩

Topics

Resources

License

Stars

Watchers

Forks

Packages

No packages published
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy