代码如下:
if (plus.os.name == 'iOS') {
var UIPasteboard = plus.ios.importClass("UIPasteboard");
var generalPasteboard = UIPasteboard.generalPasteboard();
var value = generalPasteboard.valueForPasteboardType("public.utf8-plain-text");
// value就是粘贴板的值
alert(value);
} else if (plus.os.name == 'Android') {
var Context = plus.android.importClass("android.content.Context");
var main = plus.android.runtimeMainActivity();
var clip = main.getSystemService(Context.CLIPBOARD_SERVICE);
var value = plus.android.invoke(clip, "getText");
// value就是粘贴板的值
alert(value);
}
1 个评论
要回复文章请先登录或注册
大图APP