Quantcast
Channel: Appcelerator Developer Center Q&A Unanswered Questions 20
Viewing all articles
Browse latest Browse all 8068

Pass an alloy view to native module

$
0
0

I seem to be having an issue with passing a view based on an alloy controller to a native module that will then be added to the native modules view using [self addSubview].

Easy example:

var home = Alloy.createController("simple",{});
var overlay1 = home.getView();
var Barcode = require('ti.barcode');
Barcode.allowRotation = true;
Barcode.displayedMessage = '';
Barcode.allowMenu = false;
Barcode.useLED = true;
Barcode.useFrontCamera = true;
Barcode.capture({
                animate: false,
                overlay: overlay1,
                showCancel: false,
                showRectangle: true,
                keepOpen: false
});
and inside simple.xml
<Alloy>
    <View id="overlay">
        <View id="leftBar"/>
        <View id="rightBar"/>
        <View id="create" onClick="doCreate">
            <Label id="createT" class="label"/>
        </View>
        <View id="retrieve" onClick='doRetrieve'>
            <Label id="retrieveT" class="label"/>
        </View>
        <View id="topbarView">
            <Label id="align" class='ltitle'>
        </View>
        <View id="messageWaiting" onClick="onMessageWaiting">
            <Label id="message" class="ltitle"/>
        </View>
    </View>
</Alloy>
In the barcode module its doing something like [myView addSubview:customOverlay];

Now if I manually go through and call Ti.UI.createView() .. and add all of the components there and then pass it to the module, everything works. I'm sure I'm missing something.

BTW .. this is using 3.2.0.GA ios7 Xcode 5.0.2


Viewing all articles
Browse latest Browse all 8068

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>