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

Alloy - unable to access required view elements

$
0
0
  • app: iOS mobile
  • sdk: 3.2.0.GA
  • os: osx mavericks
  • studio Titanium Studio, build: 3.2.0.201312191547
  • output: iPhone Simulator v 7.x

I'm having difficulty understanding why I'm unable to manipulate properties of views included with the <Require> tag. I tried Tony L's answer to a similar question but it didn't help. So, I'm posting a new question. I created a new project for this use case.

index.xml

<Alloy>
    <Window class="container">      
        <View height="50dp" top="50dp" id="mainView" layout="vertical">
            <Require id="v1" src="v1" type="view"/>
            <Require id="v2" src="v2" type="view"/>
        </View>
    </Window>
</Alloy>
v1.xml
<Alloy>
    <View backgroundColor="#ece" class="container">
        <Label> This is view 1</Label>
    </View>
</Alloy>
v2.xml
<Alloy>
    <View backgroundColor="#cec" class="container">
        <Label> This is view 2</Label>
    </View>
</Alloy>
index.js
$.index.addEventListener('open', function() {
 
    $.mainView.visible = false;
 
    // $.v1.visible = false;
    // $.v2.visible = false;
});
If I run this app as posted here, mainView is hidden at launch which is the expected behavior. However, if I try this with v1 or v2 -- each being required views -- the use case fails. Apparently, there is something basic that I'm missing about required views and I'll be darned if I know what that is.

Ultimately, I plan to use this case to create a toggle that a user can switch between two required, mutually exclusive views without navigating away from the parent page. But for some reason, the mechanics of this escape me right now. I hate when that happens.

Your time and assistance are appreciated.


Viewing all articles
Browse latest Browse all 8068

Trending Articles



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