[TIMOB-8979] iOS: Ti.Media.openPhotoGallery's cancel event doesn't trigger on iPad
GitHub Issue | n/a |
Type | Bug |
Priority | High |
Status | Closed |
Resolution | Fixed |
Resolution Date | 2012-05-10T10:59:48.000+0000 |
Affected Version/s | Release 2.1.0 |
Fix Version/s | Release 2.0.2, Release 2.1.0, Sprint 2012-10 API |
Components | iOS |
Labels | SupportTeam, api, module_media, qe-testadded |
Reporter | Varun Joshi |
Assignee | Sabil Rahim |
Created | 2012-05-03T15:23:41.000+0000 |
Updated | 2012-07-11T13:27:20.000+0000 |
Description
Code
{noformat}
var win = Titanium.UI.createWindow({
backgroundColor:'white'
});
win.open();
var imageView = Titanium.UI.createImageView({
height:200,
width:200,
top:20,
left:10,
backgroundColor:'#999'
});
win.add(imageView);
var popoverView;
var arrowDirection;
if (Titanium.Platform.osname == 'ipad')
{
// photogallery displays in a popover on the ipad and we
// want to make it relative to our image with a left arrow
arrowDirection = Ti.UI.iPad.POPOVER_ARROW_DIRECTION_LEFT;
popoverView = imageView;
}
Titanium.Media.openPhotoGallery({
success:function(event)
{
var cropRect = event.cropRect;
var image = event.media;
// set image view
Ti.API.debug('Our type was: '+event.mediaType);
if(event.mediaType == Ti.Media.MEDIA_TYPE_PHOTO)
{
imageView.image = image;
}
else
{
// is this necessary?
}
Titanium.API.info('PHOTO GALLERY SUCCESS cropRect.x ' + cropRect.x + ' cropRect.y ' + cropRect.y + ' cropRect.height ' + cropRect.height + ' cropRect.width ' + cropRect.width);
},
cancel:function()
{
alert('cancelled fired');
},
error:function(error)
{
},
allowEditing:true,
popoverView:popoverView,
arrowDirection:arrowDirection,
mediaTypes:[Ti.Media.MEDIA_TYPE_VIDEO,Ti.Media.MEDIA_TYPE_PHOTO]
});
{noformat}
Expected Behavior
The alert in cancel event should get fired.
Actual Behavior
This does not work on the iPad simulator but works fine on iPhone simulator
Comments
JSON Source
[Pull pending](https://github.com/appcelerator/titanium_mobile/pull/2149)
Tested with 2.0.2.v20120515140151 on iPad 3 5.1.1