var self = Ti.UI.createView();
var lblId = Ti.UI.createLabel({
text : 'No valid files were identified.',
left : 8,
right : 8,
top : 32,
});
self.add(lblId);
var imgFile=Ti.UI.createImageView({
left:8,
right:8,
top:80,
height:200,
});
self.add(imgFile);
var tmrCheck = setInterval(function() {
//now copy more than one image from iOS Photos (like attachment) and see the result
//notice that Blob size and image refers to only one image
if (Ti.UI.Clipboard.hasData('image')) {
imgFile.image=Ti.UI.Clipboard.getData('image');
Ti.API.info(Ti.UI.Clipboard.getData('image').getSize());
lblId.text = 'Media Identified!';
}else{
lblId.text ='No valid files were identified.';
}
}, 3000);
The following Obj-C code gives the total number of items currently present in the clipboard:
-(id)getDataCount:(id)arg { ENSURE_STRING_OR_NIL(arg); __block NSInteger result; TiThreadPerformOnMainThread(^{ UIPasteboard *board = [UIPasteboard generalPasteboard]; NSInteger size = board.numberOfItems; if (size > 0){ DebugLog(@"[DEBUG] DataCount: %d", size); result = size; }else{ result = 0; } }, YES); return NUMLONG(result); }+10