Change size of showCamera overlay
I am trying to add additional interface elements to a showCamera display in my iOS app.
I know I can add an overlay with the code below. The problem: This overlay will always have the size of the entire screen. This is a problem as the camera's default开发者_开发知识库 control elements (flash, HDR, camera switcher) are not accessible anymore.
Setting touchEnabled: false
in createView()
makes it so that all events are passed through. This makes the original control elements work, at the expense of my new elements not being accessible at all.
So my idea was to make the view smaller so that it would not obstruct the original elements at the top. My own controls would be positioned on the middle/right, so no conflict there. However, no such luck.
Setting height
/width
attributes in createView
does nothing. Setting these properties later on (either directly or through animate()
has no effect.
My simplified code:
var myOverlay = Titanium.UI.createView({
backgroundColor: '#0F0', // just to see what is happening
height: 200 // does not work
// touchEnabled: false
// touchEnabled apparently can't be re-enabled for objects contained within this view.
});
var mySlider = Titanium.UI.createSlider({
[...]
});
myOverlay.add(mySlider);
Titanium.Media.showCamera({
overlay: myOverlay,
[...]
});
myOverlay.height = 200; // does not work
myOverlay.animate({height: 200}); // does not work
All these methods to control the height do work when I add the same overlay to a Window or another overlay. Not so when I use showCamera()
.
Question: How do I control the size of the myOverlay
or how do I otherwise make the standard control elements accessible while also letting me throw in my own controls?
If you myOverlay
doesn't actually need to cover those controls then you could try to set the opactity
to a value below 1
and keep the touchEnabled
set to false
as to pass through the events. I assume this way the user could still see the controls through the the myOverlay
. Also have you tried messing around with the positioning: top, right, bottom, left
?
This may be a terrible workaround but if the first view is the full size then you could also try to set the opacity
to 0
and then add another view inside of the first view with your proper size and slider in it?
精彩评论