Quantcast
Viewing all articles
Browse latest Browse all 8068

Why do Android and iOS return different label objects to my event listener?

Using the following code in the android emulator vs the ios simulator I receive different event sources. In the emulator I receive [object Label] but in the simulator [object TiUILabel]. It seems that the result of thisis that I get different properties when I run the app for different platforms. How can I get android and iOS to pass the same type of label object to my onClick listener?

The full results of running Ti.API.info can be found at Android & iOS

Titanium SDK: 3.1.2.GA

Platform & version: iOS 6.1, Android 4.3, Android 4.2.2

Device: iOS simulator & Android emulator

Host Operating System: OSX 10.8.4

Studio: Titanium Studio, build: 3.1.2.201308091617

<ListView id="news_list" defaultItemTemplate="news_template">
    <Templates>
        <ItemTemplate name="news_template">
            <View class='story_container'>
                <View class="image_container">
                    <ImageView class="story_image" bindId="photo" />
                </View>
                <View class="story" >
                    <Label class="news_title" bindId="news_title" />
                    <Label class="brief" bindId="brief" />
                    <Label class="url_text" bindId="url_text" onClick="getFullStory" />
                </View>
            </View>
        </ItemTemplate>
    </Templates>
    <ListSection>
        <ListItem url_text:url="http://some.url" url_text:text="Full Story" news_title:text="Story Title" brief:text="Brief text from article" photo:image="images/image.png" />
        <ListItem url_text:url="http://some.url" url_text:text="Full Story" news_title:text="Story Title" brief:text="Brief text from article" photo:image="images/image.png" />
<ListItem url_text:url="http://some.url" url_text:text="Full Story" news_title:text="Story Title" brief:text="Brief text from article" photo:image="images/image.png" />
    </ListSection>
</ListView>
function getFullStory(e) {
    Ti.API.info('<--------E-----------------------------');
    Ti.API.info(e);
    for (var ekey in e) {
        var evalue = e[ekey];
        Ti.API.info(ekey+' : '+evalue);
    }
    Ti.API.info('--------E----------------------------->');
 
    Ti.API.info('<--------E SOURCE-----------------------------');
    Ti.API.info(e.source);
    for (var key in e.source) {
        var value = e.source[key];
        Ti.API.info(key+' : '+value);
    }
    Ti.API.info('--------E SOURCE----------------------------->');
 
    Ti.API.info('<--------SOURCE URL-----------------------------');
    Ti.API.info(e.source.url);
    Ti.API.info('--------SOURCE URL----------------------------->');
}

Viewing all articles
Browse latest Browse all 8068

Trending Articles



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