cocos creator 安卓与IOS写剪切板原生接口

cocos creator js调用安卓与IOS写剪切板原生接口

    public static copyTextToClipboard(text: string) {
        if (cc.sys.os == cc.sys.OS_ANDROID && cc.sys.isNative) {
            jsb.reflection.callStaticMethod("org/cocos2dx/lib/Cocos2dxHelper", "copyTextToClipboard", "(Ljava/lang/String;)V",text);
        } 
        if(cc.sys.os == cc.sys.OS_IOS && cc.sys.isNative){
            jsb["copyTextToClipboard"](text);
        }
    }

你可能感兴趣的:(android,ios)