ipad openPhotoGallery popover control
This Works (hacked together from different parts of kitchen sink)
Titanium 1.2.1
iPad Version 4
Not sure about the SDK version, I think its the latest though (I went and manually DL'd it tonight, installed it, and then it downloaded some more stuff).
//
// create base UI tab and root window
//
var win = Titanium.UI.createWindow({
title:'Tab 1',
backgroundColor:'#fff'
});
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)
{
},
cancel:function()
{
},
error:function(error)
{
},
allowImageEditing:true,
//popoverView:popoverView,
arrowDirection:arrowDirection,
});
// open tab group
win.open();
You'll notice at the bottom, the popoverView is commented out.
If I used this popoverView property in any way whatsoever, it hits the fan.
What gives?
1 Answer
-
I feel a bit silly… but such is the nature of diving in and hacking something together!
I got it working!
This guy needs to come first, before the openPhotoGallery is called:
win.open();
I was basing my examples off of the generated + the photo_gallery.js in KitchenSink. Looking over it now that I know the problem, it makes sense. the Kitchen Sink version has already called win.open at some point, earlier in the menu walks.
Hewray! I was really wanting to love Titanium, and now I still get to :D