ios插件开发,添加了一个imageview,在imageview添加了点击方法,却不知怎么返回给js。
输出了日志,点击事件是有触发了,但不知在js端怎么接收点击控件后的消息。
麻烦帮帮忙解决下,项目就差最后一步了。
ios插件开发,添加了一个imageview,在imageview添加了点击方法,却不知怎么返回给js。
输出了日志,点击事件是有触发了,但不知在js端怎么接收点击控件后的消息。
麻烦帮帮忙解决下,项目就差最后一步了。
H5+部分插件已经开源可以参考:https://github.com/dcloudio
插件开发中也有相关示例
/**
@brief 同步调用JavaScript回调函数 参考:`toCallback:withReslut:`
*/
-(void) toSyncCallback: (NSString*) callbackId withReslut:(NSString*)message;
/**
@brief 异步调用JavaScript回调函数
@param callbackId 回调ID
@param message JSON格式结果 参考:`toJSONString`
@return void
*/
-(void) toCallback: (NSString*) callbackId withReslut:(NSString*)message;
///调用JS层错误回调
-(void) toErrorCallback: (NSString*) callbackId withCode:(int)errorCode;
-(void) toErrorCallback: (NSString*) callbackId withCode:(int)errorCode withMessage:(NSString*)message;
-(void) toErrorCallback: (NSString*) callbackId withCode:(int)errorCode withMessage:(NSString*)message keepCallback:(BOOL)keepCallback;
-(void) toErrorCallback: (NSString*) callbackId withInnerCode:(int)errorCode withMessage:(NSString*)message;
-(void) toErrorCallback: (NSString*) callbackId withInnerCode:(int)errorCode withMessage:(NSString*)message keepCallback:(BOOL)keepCallback;
///将OC NSError转化为H5+Error
-(void) toErrorCallback: (NSString*) callbackId
withNSError:(NSError*)error;
///封装插件使用的SDK产生的错误信息
///code:-100
///message:[self.name self.contexnt:errorCode]message,self.sdkErrorURL
-(void) toErrorCallback: (NSString*) callbackId
withSDKError:(int)errorCode
withMessage:(NSString*)message;
-(void) toErrorCallback: (NSString*) callbackId
withMoudleName:(NSString*)moudleName
withCode:(int)errorCode
withMessage:(NSString*)message withURL:(NSString*)url;
-(void) toSucessCallback: (NSString*) callbackId withInt:(int)intValue;
-(void) toSucessCallback: (NSString*) callbackId withInt:(int)errorCode keepCallback:(BOOL)keepCallback;
-(void) toSucessCallback: (NSString*) callbackId withDouble:(double)doubleValue;
-(void) toSucessCallback: (NSString*) callbackId withDouble:(double)doubleValue keepCallback:(BOOL)keepCallback;
-(void) toSucessCallback: (NSString*) callbackId withString:(NSString*)stringValue;
-(void) toSucessCallback: (NSString*) callbackId withString:(NSString*)stringValue keepCallback:(BOOL)keepCallback;
-(void) toSucessCallback: (NSString*) callbackId withJSON:(NSDictionary*)jsonValue;
-(void) toSucessCallback: (NSString*) callbackId withJSON:(NSDictionary*)jsonValue keepCallback:(BOOL)keepCallback;
lxxeon (作者)
谢谢,我突然想到,uiwebview可以直接调js,所以问题解决了。
2015-09-19 15:03