2026/10/27 17:43:29
自定义教具与样式
适用于 Whiteboard iOS SDK 2.16.147。先按插件介绍启用插件,在入房成功后提交当前用户的教具状态。
Objective-C
WhiteMemberState *state = [WhiteMemberState new];
state.currentApplianceName = AppliancePencil;
state.strokeColor = @[@32, @102, @255];
state.strokeWidth = @4;
state.strokeOpacity = @0.8;
[room setMemberState:state];
| 字段 | 用途 |
|---|---|
| currentApplianceName | Selector/Pencil/Shape/Text 等教具切换 |
| strokeColor / strokeWidth / strokeOpacity | RGB 颜色、粗细、线条透明度 |
| shapeType / fillColor / fillOpacity | 图形类型、填充颜色和透明度 |
| textColor / textSize | 文字颜色和字号 |
| pencilEraserSize | 局部橡皮尺寸 |
WhiteRoomConfig.appliancePluginOptions.extras 支持插件已开放的可序列化配置,例如 dottedStroke、longDottedStroke、normalStroke、textEditor、strokeWidth、pencilEraser、overwriteSelectorStyles。在入房前设置:
Objective-C
WhiteAppliancePluginOptions *options = [WhiteAppliancePluginOptions new];
options.extras = @{
@"useBackgroundThread": @YES,
@"normalStroke": @{ @"lineCap": @"round" },
@"dottedStroke": @{ @"lineCap": @"round", @"segment": @1, @"gap": @2 },
@"overwriteSelectorStyles": @{
@"highlightBox": @{ @"borderColor": @"#2066ff" },
@"highlightBoxPoint": @{ @"backgroundColor": @"#ffffff" }
}
};
roomConfig.appliancePluginOptions = options;
以上 Selector 样式作用于内嵌白板界面的选中框。应用可用 UIKit/SwiftUI 控制本端工具栏,并通过 setMemberState: 设置教具与样式;撤销、重做、复制、删除使用本端 WhiteRoom 的公开方法。
Auto Shape 可通过业务扩展模型传递,见Auto Shape。完整签名见客户端 API。