本页内容
注释云朵边框样式
允许用户对矩形、圆形和多边形注释的边框样式设置为云状样式,边框样式也可以在实线、虚线或云朵样式之间进行更改。ComPDFKit 为注释云朵边框样式设置提供了方便的 API,同时还提供了demo演示。
以下是矩形注释添加云朵样式边框的示例代码:
swift
// 虚线样式
let border = CPDFBorder(style: .dashed, lineWidth: 1, dashPattern: [2, 1])
let square = CPDFSquareAnnotation(document: document)
// 设置注释属性。
square?.bounds = CGRect(x: 400, y: 200, width: 80, height: 300)
square?.color = UIColor.green
square?.interiorColor = UIColor.purple
square?.opacity = 1.0
square?.interiorOpacity = 1.0
// 设置实线或者虚线边框样式
square?.border = border
// 设置云朵边框样式
let borderEffect = CPDFBorderEffect()
borderEffect?.borderEffectType = .cloudy
borderEffect?.intensityType = .two
square?.borderEffect = borderEffect
page.addAnnotation(square!)
objective-c
// 虚线样式
CPDFBorder *border = [[CPDFBorder alloc] initWithStyle:CPDFBorderStyleDashed
lineWidth:1
dashPattern:@[@(2), @(1)]];
// 在该页面上创建矩形释对象。
CPDFSquareAnnotation *square = [[CPDFSquareAnnotation alloc] initWithDocument:document];
// 设置注释属性。
square.bounds = CGRectMake(400, 200, 80, 300);
square.color = [UIColor greenColor];
square.interiorColor = [UIColor purpleColor];
square.opacity = 1.0;
square.interiorOpacity = 1.0;
square.border = border;
// 设置云朵边框样式
CPDFBorderEffect *borderEffect = [[CPDFBorderEffect alloc] init];
borderEffect.intensityType = CPDFIntensityTypeTwo;
borderEffect.borderEffectType = CPDFBorderEffectTypeCloudy;
square.borderEffect = borderEffect
[page addAnnotation:square];
云朵边框样式类型枚举
Name | Description |
---|---|
CPDFIntensityTypeZero | 影响强度范围为0 ~ 2,当为0时为实线 |
CPDFIntensityTypeOne | |
CPDFIntensityTypeTwo |
Name | Description |
---|---|
CPDFBorderEffectTypeSolid | 边框样式样式为实线 |
CPDFBorderEffectTypeCloudy | 边框样式样式为云朵样式 |