白板主调接口
白板的显示
1.1 SDK内置显示和划线的视图ECWBSSView,代码如下:
- //SDK内部实现了一个view来管理所有白板/文档显示以及进行划线等相关动作的捕捉和显示, 应用只需要生成这么一个view,将view的大小和位置传进来即可
- ECWBSSView *view = [[ECWBSSView alloc] initWithFrame:CGRectMake(0.0f, frameY, CGRectGetWidth([UIScreen mainScreen].bounds), CGRectGetHeight([UIScreen mainScreen].bounds)-frameY-50.0f-40.0f-64.0f)]
1.2 房间管理相关
1.2.1 创建房间,代码如下:
- //创建房间成功后sdk自动加入该房间,可直接弹出显示页面。
- ECWBSSRoom *room = [[ECWBSSRoom alloc] init];
- room.password = password.text;
- room. roomType= 1;//1临时房间(房间内没人5分钟后自动解散),2永久房间
- [[ECWBSS sharedInstance].WBSSManger createRoom:room completion:^(ECWBSSError *error, ECWBSSRoom *room) {
- if (error.code == ECErrorCode_Success) {
- //SDK内置的白板/文档显示以及划线的view
- DisplayViewController *displayView = [[DisplayViewController alloc] init];
- displayView.room = room;
- [self.navigationController pushViewController:displayView animated:YES];
- } else { //各类错误处理
- }];
1.2.2 加入房间,代码如下:
- ECWBSSRoom *room = [[ECWBSSRoom alloc] init];
- room.roomId = roomid.text.intValue;
- room.password = password.text;
- room. roomType= 1;//1临时房间(房间内没人5分钟后自动解散),2永久房间
- [[ECWBSS sharedInstance].WBSSManger joinRoom:room completion:^(ECWBSSError *error, ECWBSSRoom *room) {
- if (error.code == ECErrorCode_Success) {
- //SDK内置的白板/文档显示以及划线的view
- DisplayViewController *displayView = [[DisplayViewController alloc] init];
- displayView.room = room;
- [self.navigationController pushViewController:displayView animated:YES];
- } else {
- //错误处理
- }
- }];
1.2.3 离开房间,代码如下:
- __weak typeof(self) weakself = self;
- [[ECWBSS sharedInstance].WBSSManger leaveRoom:self.room completion:^(ECWBSSError *error, ECWBSSRoom *room) {
- if (error.code != ECErrorCode_Success) {
- UIAlertView *alertView = [[UIAlertView alloc] initWithTitle:nil message:[NSString stringWithFormat:@"error:%ld",(long)error.code] delegate:self cancelButtonTitle:@"确定" otherButtonTitles:nil];
- [alertView show];
- }
- [weakself.navigationController popViewControllerAnimated:YES];
- }];
1.2.4 解散房间,代码如下:
- __weak typeof(self) weakself = self;
- [[ECWBSS sharedInstance].WBSSManger deleteRoom:self.room completion:^(ECWBSSError *error, ECWBSSRoom *room) {
- if (error.code != ECErrorCode_Success) {
- UIAlertView *alertView = [[UIAlertView alloc] initWithTitle:nil message:[NSString stringWithFormat:@"error:%ld",(long)error.code] delegate:self cancelButtonTitle:@"确定" otherButtonTitles:nil];
- [alertView show];
- }
- [weakself.navigationController popViewControllerAnimated:YES];
- }];
1.2.5 清除房间划线信息,代码如下:
- __weak typeof(self) weakself = self;
- [[ECWBSS sharedInstance].WBSSManger clearRoom:self.room completion:^(ECWBSSError *error, ECWBSSRoom *room) {
- if (error.code != ECErrorCode_Success) {
- UIAlertView *alertView = [[UIAlertView alloc] initWithTitle:nil message:[NSString stringWithFormat:@"error:%ld",(long)error.code] delegate:self cancelButtonTitle:@"确定" otherButtonTitles:nil];
- [alertView show];
- }
- }];
1.2.6 获取房间成员,代码如下:
- __weak typeof(self) weakself = self;
- [[ECWBSS sharedInstance].WBSSManger getMembersOfRoom:self.room.roomId completion:^(ECWBSSError *error, NSArray *members) {
- [waitAlert dismissWithClickedButtonIndex:0 animated:YES];
- if (error.code == ECErrorCode_Success) {
- weakself.memberArray = members;
- [weakself.tableView reloadData];
- } else {
- UIAlertView *alertView = [[UIAlertView alloc] initWithTitle:nil message:[NSString stringWithFormat:@"error:%ld",(long)error.code] delegate:self cancelButtonTitle:@"确定" otherButtonTitles:nil];
- [alertView show];
- }
- }];
1.3 操作模式设置相关
操作模式设置相关接口由[ECWBSS sharedInstance].WBSSManger来调用。
1.3.1 设置线的形状
- /**
- @brief 设置线的形状
- @param shape 自由划线:1,直线:2 , 四边形:3 三角形:4 圆:5 椭圆:6 虚线:7 箭头:8 激光笔:12
- @param roomId 房间ID
- */
- -(int) setLineShape:(LineShapeType)shape ofRoom:(int)roomId;
1.3.2 设置线的颜色
- /**
- @brief 设置线的颜色
- @param lineColor 线颜色
- @param roomId 房间ID
- */
- -(int) setLineColor:(UIColor*)lineColor ofRoom:(int)roomId;
1.3.3 设置线的大小
- /**
- @brief 设置线大小
- @param lineSize 线大小
- @param roomId 房间ID
- */
- -(int) setLineSize:(int)lineSize ofRoom:(int)roomId;
1.3.4 橡皮擦模式
- /**
- @brief 获取橡皮擦
- @param roomId 房间ID
- */
- -(int) getEraserOfRoom:(int)roomId;
1.3.5 画笔模式
- /**
- @brief 获取画笔
- @param type 画笔类型
- @param roomId 房间ID
- */
- -(int) getPenType:(PenType)type ofRoom:(int)roomId;
1.3.6 设置填充模式
- /**
- @brief 设置是否填充模式,默认是非填充模式
- @param roomId 房间id
- @param bFill 是否填充 0 非填充 1 填充
- */
- -(int)setFillModeRoom:(int)roomId ofBfill:(int)bFill;
1.3.7 设置白板的绘制区域比例
- /**
- @brief 设置白板的绘制区域比例(注:发起者的比例将会使其他端保持此比例。比例>1.0为横屏,比例小于1.0为竖屏, <=0.0是全屏
- @param fixeScale 白板固定化比例
- return YES/NO 成功/失败
- */
- - (BOOL)setCurrentWhiteBoardScale:(float)fixeScale;
1.3.8 设置文档的背景颜色
- /**
- @brief 设置文档的背景颜色
- @param docBackgroudColor 线颜色
- @param roomId 房间ID
- */
- -(int) setDocBackgroundColor:(UIColor*)docBackgroudColor ofRoom:(int)roomId;
1.3.9 撤销划线
- /**
- @brief 撤销划线
- @param type 划线类型(自己的或者全部的)
- @param completion 执行结果回调block
- */
- -(void) drawUndoO-(void) drawUndoOfType:(UndoType)type completion:(void(^)(ECWBSSError;
1.3.10 恢复划线
- /**
- @brief 恢复划线
- @param completion 执行结果回调block
- */
- -(void) drawRedoC-(void) drawRedoCompletion:(void(^)(ECWBSSError;
1.3.11 设置删除划线模式
- /**
- @brief 设置删除划线模式(按层级删除一条划线)
- return YES/NO 成功/失败
- */
- - (BOOL)setCurrentDeleteModel;
1.4 文档管理相关
文档管理相关接口由[ECWBSS sharedInstance].WBSSManger来调用。
1.4.1 上传文档
- /**
- @brief 上传文档
- @param document 上传的文档信息
- @param progress 上传进度代理
- @param completion 执行结果回调block
- @return 进度id,用户上传进度,标识上传id,不用于文档id
- */
- -(unsigned int)uploadDocument:(ECWBSSDocument*)document progress:(id<ECWBSSProgressDelegate>)progress completion:(void(^)(ECWBSSError *error ,ECWBSSDocument *document))completion;
1.4.2 共享文档
- /**
- @brief 共享文档
- @param document 共享的文档
- @param completion 执行结果回调block
- */
- -(void)shareDocument:(ECWBSSDocument*)document completion:(void(^)(ECWBSSError *error ,ECWBSSDocument *document))completion;
1.4.3 清除文档
- /**
- @brief 清除文档
- @param document 清除的文档
- @param completion 执行结果回调block
- */
- -(void)removeDocument:(ECWBSSDocument*)document completion:(void(^)(ECWBSSError *error ,ECWBSSDocument *document))completion;
1.4.4 清除当前页面划线
- /**
- @brief 清除当前页面
- @param document 清除的文档
- @param userId 清除的用户ID
- @param completion 执行结果回调block
- */
- -(void)clearCurrentPageOfDocument:(ECWBSSDocument*)document andUserId:(NSString*)userId completion:(void(^)(ECWBSSError *error ,ECWBSSDocument *document))completion;
1.4.5 页面跳转
- /**
- @brief 跳转页面
- @param pageIndex 跳转页码索引
- @param document 当前文档
- @param completion 执行结果回调block
- */
- -(void)gotoPage:(int)pageIndex OfDocument:(ECWBSSDocument*)document completion:(void(^)(ECWBSSError *error ,ECWBSSDocument *document))completion;
1.4.6 跳转下一页
- /**
- @brief 下一页
- @param document 当前文档
- @param completion 执行结果回调block
- */
- -(void)gotoNextPageOfDocument:(ECWBSSDocument*)document completion:(void(^)(ECWBSSError *error ,ECWBSSDocument *document))completion;
1.4.7 跳转上一页
- /**
- @brief 上一页
- @param document 当前文档
- @param completion 执行结果回调block
- */
- -(void)gotoPrevPageOfDocument:(ECWBSSDocument*)document completion:(void(^)(ECWBSSError *error ,ECWBSSDocument *document))completion;
1.4.8 保存当前显示的图片文档
- /**
- @brief 保存当前显示的图片文档
- @param filePath 保存的文件路径
- type 保存方式 0 保存单张图片 1 保存成pdf
- */
- -(void)saveCurrentShowImageFileOfFilePath:(NSString *)filePath intType:(int)type;