Nice confusing title...
I used the ScrollView kitchen sink sample. In essence, they create a ScrollView, and then a set of Views that are part of the Views attribute of a scrollview.
I've done the same thing and it works great...you can flip, horizontally, through your scrollview and see all the individual views. My use case is that I read a set of contacts (name, address etc) and display them on the scrollview and you can flip through them to find the one you want.
This works great...except that when a specific view within my scrollview has a lot of vertical text, there is no way to scroll vertically within that View within the Scrollview.
Is this possible or is it not allowed by iPhone?
var scrollView = Titanium.UI.createScrollableView({ views:[], showPagingControl:true, showVerticalScrollIndicator:true, pagingControlHeight:40, maxZoomScale:2.0, touchEnabled:true, contentHeight:'auto', contentWidth:320, currentPage:1 });I then programatically in a for loop create views, add lables to that view, and add the view to the Views attribute of the scrollview
for(var i in myData) { var thisItem = myData[i]; //get next contact record var newView = Ti.UI.createView({ backgroundColor:'black',layout:'vertical',contentHeight:'auto',touchEnabled:true,showVerticalScrollIndicator:true }); // add bunch of lables to the view newView.add(lFirm); newView.add(lAddress1); newView.add(lAddress2); newView.add(lCity); newView.add(lZip); // many more, ommitted here for brevity // add this view to my scrollview and loop around // for the next contact scrollView.addView(newView); }//forSo, bascally, create scrollview, and then run through my data list constructing Views which get added to the scrollview. I can flip through the contacts (horizontal), but I cannot see the text that goes past the bottom of the screen as there appears to be no vertical scroll on those sub views.
All help/suggestions appreciated.
5 Answers
I'm not really sure myself, but this line
var newView = Ti.UI.createView({`probably needs to be
var newView = Ti.UI.createScrollView({`.Based on the properties you are setting for it (showVerticalScrollIndicator, contentHeight, etc) looks like that was your intention rather than just a regular
view.
Hopefully you'll get some immediate results from that change.
Sorry for my late response...was out on vacation.
Thanks for the suggestion...I see where you're going with this...create a scrollable view on the scrollable view (instead of regular views on the scrollableview).
I tried it but its not scrolling vertically within that view. I'll try play a little more with the settings.
If the question is if you can add a view element to a scrollview element I have successfully added a tableview to a scrollview. Thus, it should follow that you can add any view to a scrollview.
Consider making your question more to the point. If you have multiple questions make multiple threads.
I have the same problem... Did you find a solution ?
I believe you are confusing 2 objects
scrollView allows you to scroll up to bottom or left to right (never both). scrollView DOES NOT have views property, you append them by using .add(view)
scrollABLE-View is like the dashboards for both android and iPhone. It allows horizontal navigation. Its basically a view( { layout: horizontal } ) with paging capabilites
I would implement Both. put a vertical scrollView (watchout with layout: 'vertical', might not work as expected) appending scrollableViews as children
Your Answer
Think you can help? Login to answer this question!