WIS SDK For IOS
IOS9以上请在plist中设置
App Transport Security Settings
Allow Arbitrary Loads 为 YES
1、在AppDelegate.m中调用loadResources
#import <WISSDK/WISSDK.h>
- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions {
[WISSDK loadResources];
return YES;
}
2、创建WISView
在storyboard中设置View的Class为WISView,或者动态创建:
WISView *wisView = [[WISView alloc] init];
3、设置参数
//设置accessId、accessKey、wisId
[_wisView setupAccessId:@"908487997682"
accessKey:@"L5eyTQ950VTtpq4q1Q4h7cvuPvYEIAD7 "
wisId:@"ab23e2a08321f5228d537fa40dbf936d"];
4、设置委托(可选)
//类型是:WISViewDelegate
_wisView.delegate = self;
...
- (void) onSuccess
{
//加载成功时调用
NSLog(@"onSuccess");
}
- (void) onFailureWithError:(NSString*) error
{
//发生错误时调用
NSLog(@"onFailureWithError: %@",error);
}
- (void) onUpdateUserWithTotal:(int64_t) total
{
//有新客户端上线时调用
NSLog(@"onUpdateUserWithTotal: %lld",total);
}
- (void) onCustomMessageWithMsg:(NSDictionary*) msg
{
//收到自定义消息时调用
NSLog(@"onCustomMessageWithMsg: %@",msg);
}
- (void) onConnect
{
//白板服务连接成功
NSLog(@"onConnect");
}
- (void) onReconnect
{
//白板服务重连
NSLog(@"onReconnect");
}
- (void) onConnectClose
{
//白板服务断开,之后会自动重连
NSLog(@"onConnectClose");
}
- (void) onDocLoadWithInfo:(NSDictionary*) info
{
//白板选择的文档信息初始化后回调
NSLog(@"onDocLoadWithInfo: %@",info);
}
- (void) onPageChangeWithPage:(int) page total:(int) total
{
//翻页的时候会回调
NSLog(@"onPageChangeWithPage: %d total: %d",page,total);
}
5、其他Api
- (void) clear; //清理白板痕迹
- (void) setLineHeight:(int) height; //设置线宽
- (void) setDrawType:(WISDrawType) type;//设置绘制类型
- (void) setColor:(UIColor*) color; //设置颜色
- (void) toPage:(int) page; //翻页
- (void) sendCustomMessage:(NSString*) msg; //发送自定义消息