UICornerShadowView Save

iOS UIView Subclass: Use CoreGraphics to control the direction of Rect Corner、Shadow 、Border

Project README

CI Status Version License Platform

掘金

SFCSBView

iOS UIView Subclass: Use CoreGraphics to control the direction of Rect Corner、Shadow 、Border

Example

// UIAppearance
[SFCSBView appearance].cornerRadius = 20;
[SFCSBView appearance].rectCornner = UIRectCornerAllCorners;
[SFCSBView appearance].shadowPosition = UIShadowPostionAll;
[SFCSBView appearance].shadowRadius = 20;
[SFCSBView appearance].borderColor = [UIColor systemBlueColor];
[SFCSBView appearance].borderWidth = 5;
[SFCSBView appearance].borderPosition = UIBorderPostionAll;


SFCSBView * shadowView = [SFCSBView new];
shadowView.cornerRadius = 20;
shadowView.rectCornner = UIRectCornerAllCorners;
shadowView.shadowPosition = UIShadowPostionAll;
shadowView.shadowColor = [[UIColor blackColor]colorWithAlphaComponent:0.6];
shadowView.shadowRadius = 20;
shadowView.borderColor = UIColor.systemBlueColor;
shadowView.borderWidth = 5;
shadowView.borderPosition = UIBorderPostionAll;

Features

  1. Surpport xib / storyboard
image
  1. Using them freedomly
image
  1. Create and process image

for objc:

// Generate UIImage by color or gradient colors, then start UIImage process flow
UIColor.lightGrayColor.sf_flow.corner(10, UIRectCornerAllCorners).border(0.5, UIColor.blackColor).image;
@[UIColor.redColor,UIColor.purpleColor].sf_gradientFlow(YES,self.gradientButton.frame.size).corner(10, UIRectCornerTopLeft|UIRectCornerBottomRight).border(1, UIColor.blackColor).image

// UIImage Process Flow
[UIImage new].sf_flow.circle.resize(CGSizeMake(40, 40)).blur(SFBlurEffectLight).corner(10, UIRectEdgeAll).border(1, UIColor.redColor)

for swift:

let _ = UIColor.red
            .sf_flow(with: CGSize.init(width: 40, height: 40))
            .blur(with: SFBlurEffectLight)
            .border(withWidth: 1, color: .gray)
            .shadow(with: UIColor.black.withAlphaComponent(0.5), offset: .init(width: 10, height: 10), blurRadius: 10)
            .resize(with: .init(width: 20, height: 20))
            .circle
            .image();

CocoaPods

pod 'SFImageMaker'

Preview

Compare with CALayer

compare with CALayer

Random Cells

Review

Performance

1000 shadow images only need 29MB and 1.01s

In this condition, maximum cpu occupancy rates is 45% and 60FPS when the count of cell is 1000 and quick slide,use iPhone 7, iOS13.3.1.

In extreme cases,no reuse, maximum cpu occupancy rates is 140% and 60FPS when the count of cell is 1000 and quick slide.

Review

Open Source Agenda is not affiliated with "UICornerShadowView" Project. README Source: SilverFruity/UICornerShadowView

Open Source Agenda Badge

Open Source Agenda Rating