• Stars
    star
    397
  • Rank 108,561 (Top 3 %)
  • Language
    Objective-C
  • License
    Apache License 2.0
  • Created almost 10 years ago
  • Updated almost 9 years ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

A funny iOS library. Draw a smooth bezier through several points you designated. The curve‘s bend level is adjustable.

LxThroughPointsBezier

Draw a smooth bezier through several points you designated. The curve‘s bend level is adjustable.

Installation

You only need drag UIBezierPath+LxThroughPointsBezier.h and UIBezierPath+LxThroughPointsBezier.m to your project.

Podfile

pod 'LxThroughPointsBezier', '~> 1.0.0'

Support

Minimum support iOS version: iOS 5.0

How to use

    #import "UIBezierPath+LxThroughPointsBezier.h"

    CGPoint point1 = CGPointMake(30, 180);
    CGPoint point2 = CGPointMake(90, 120);
    CGPoint point3 = CGPointMake(120, 200);
    CGPoint point4 = CGPointMake(160, 240);
    CGPoint point5 = CGPointMake(210, 160);
    CGPoint point6 = CGPointMake(240, 300);
    CGPoint point7 = CGPointMake(290, 140);
    
    NSValue * point1Value = [NSValue valueWithCGPoint:point1];
    NSValue * point2Value = [NSValue valueWithCGPoint:point2];
    NSValue * point3Value = [NSValue valueWithCGPoint:point3];
    NSValue * point4Value = [NSValue valueWithCGPoint:point4];
    NSValue * point5Value = [NSValue valueWithCGPoint:point5];
    NSValue * point6Value = [NSValue valueWithCGPoint:point6];
    NSValue * point7Value = [NSValue valueWithCGPoint:point7];
    
    _pointArray = [NSMutableArray array];
    [_pointArray addObjectsFromArray:@[point1Value, point2Value, point3Value, point4Value, point5Value, point6Value, point7Value]];
    
    _curve = [UIBezierPath bezierPath];
    _curve.contractionFactor = 0.6;
    [_curve moveToPoint:point1];
    [_curve addBezierThroughPoints:_pointArray];
    
    _shapeLayer = [CAShapeLayer layer];
    _shapeLayer.strokeColor = [UIColor blueColor].CGColor;
    _shapeLayer.fillColor = nil;
    _shapeLayer.lineWidth = 3;
    _shapeLayer.path = _curve.CGPath;
    [_view.layer addSublayer:_shapeLayer];

Effect

  • demo

Be careful

The good bend level is about 0.6 ~ 0.8. The default and recommended value is 0.7.
You must wrap CGPoint struct to NSValue object, and give at least 1 point for drawing the curve.

License

LxThroughPointsBezier is available under the Apache License 2.0. See the LICENSE file for more info.

More Repositories

1

macOS_Development_Tutorials_translation

Translation of macOS development tutorials.
1,280
star
2

LxGridView

Imitation iOS system desktop icon arrangement and interaction by UICollectionView!
Objective-C
972
star
3

LxDBAnything

Automate box any value! Print log without any format control symbol! Change debug habit thoroughly!
Objective-C
431
star
4

LxThroughPointsBezier-Swift

An ideal iOS library using swift programming language. Draw a smooth curve through several points you designated. The curve‘s bend level is adjustable.
Swift
234
star
5

LxTabBarController

Inherited from UITabBarController. LxTabBarController add a powerful gesture that you can switch view controller by sweeping screen from left to right or right to left.
Objective-C
225
star
6

LxGridView-swift

Imitation iOS system desktop icon arrangement and interaction by UICollectionView!
Swift
162
star
7

Troubles-of-realizing-download-module

实现项目下载需求时遇过的那些坑
152
star
8

LxFTPRequest

A convenient FTP request library for iOS and Mac OS X using Objective-C programming language. Support progress tracking, Breakpoint continuingly etc.
Objective-C
141
star
9

LxTabBadgePoint

Easily custom viewController's tabBar badge view.
Objective-C
117
star
10

LxTabBarController-swift

Inherited from UITabBarController. To change UITabBarController interactive mode, LxTabBarController add a powerful gesture you can switch view controller by sweeping screen from left the right or right to left.
Swift
77
star
11

LxKeychain

Manage your username and password for iOS and OS X platform. Highly encryption and won't be lose even you uninstall your app.
Objective-C
55
star
12

Dreamy_download_manage_solution

续言关于下载管理的探讨
19
star
13

The-strategy-of-building-a-method

论构造方法的方法论
18
star
14

LxKeychain-swift

Swift
18
star
15

LxVolumeManager

Control and observe iOS system volume.
Objective-C
17
star
16

LxPDFParser

A delightful iOS library. Simply parse the PDF file's structure. The foundation to come true more complicated functions.
Objective-C
16
star
17

LxIAPManager

Apple IAP capsulation.
Objective-C
15
star
18

FauxPas_document_translation

10
star
19

LxNavigationController

A convenient navigationController inherited from UINavigationController. LxNavigationController add a powerful gesture you can pop view controller only if you sweep the screen from left the right.
Objective-C
10
star
20

LxGitHubStarCounter

Calculate user's total star.
Python
9
star
21

LxProjectTemplate

As this repo's name.
Objective-C
8
star
22

Android-Development-Tutorials-translation

Translation of Android development tutorials.
7
star
23

LxIAPManager-swift

Apple IAP capsulation.
Swift
7
star
24

LxHTTPManager

适用于项目实践的网络请求管理封装
Objective-C
7
star
25

LxLabel

An evolutional label inherited from UILabel. It can generate a large number of effect, and use simple properties to set.
Objective-C
6
star
26

clang_static_analyzer_document_translation

6
star
27

LxTabBadgePoint-swift

Easily custom viewController's tabBar badge view.
Swift
6
star
28

LxOCCodeCleaner

Clean Objective-C code.
Shell
4
star
29

xctool_document_translation

4
star
30

LxWaveLayer

Easily add wave animation.
Objective-C
3
star
31

LxPropertyDefaultValue

Setup any custom object properties default value easily.
Objective-C
3
star
32

LxDragToDismissBadgeLabel

Objective-C
2
star
33

LxKVO

Objective-C
2
star
34

LxDownloadTask

个人认为理想的下载任务对象的模型,暂尚未具体实现
Objective-C
2
star
35

LxAppleOfficialFontManager-swift

Swift
2
star
36

LxApplication

A feature-rich application help class inherited from UIApplication.
Objective-C
2
star
37

LxSandBoxNavigator

Simply show the directory's structure by tableView tree.
Objective-C
2
star
38

LxProjectTemplate-Swift

As the repo's name.
Swift
2
star
39

LxNavigationController-swift

A convenient navigationController inherited from UINavigationController. LxNavigationController add a powerful gesture you can pop view controller only if you sweep the screen from left the right.
Swift
2
star
40

LxBigFileDigger

Find big files.
Shell
2
star
41

Notes

notes
1
star
42

charles_documentation_translation

Charles documentationtranslation
1
star
43

LxGlobalTimerManager

1
star
44

safety_in_swift_translation

1
star
45

LxWaveLayer-swift

Easily add wave animation.
Swift
1
star
46

LxAppleOfficialFontManager

Objective-C
1
star
47

xed_document_translation

1
star
48

LxGetMacIP

Shell
1
star