How to create layout in Titanium - titanium

How do I create a layout as in the image above in titanium?
When someone scrolls, I want the left and the right column to stay fixed to the screen (as in CSS fixed position) while only the middle column scrolls.
When someone taps on a button on either the left column or the right column, the buttons in the middle column are going to be replaced with new buttons.

.1 Create the base view that contains the left and right buttons.
.2 on top of that view, create a scrollable view transparent, with the learning, eating buttons on it.
// SCROLLER
var scroller = Titanium.UI.createScrollableView({
pagingControlColor:'transparent',
});

First of all, set current window's layout to 'horizontal'.
Then create left view(Ti.UI.View), mid view(Ti.UI.ScrollView) and right view(Ti.UI.View).
Set the layout of all of these three view to 'vertical'.
Now when you would scroll, left and right view will remain at same state while just mid view will be scrolled.
Hope it would solve your problem.

Related

Move view hiding its side in android

Moving a view I try to hide all parts of view that cross some vertical line, so view starts to loose its width to 0.
The image describes better what I want.
I mean not just shrink a width with scaleX but hide, because this command compresses the photo horizontally, and I need to hide it without distortion.
How can I do it?
On the image a photo started to move left with translationX hiding line by line left side of the photo during this movement. Also, the photo is not at left edge of screen - it's on the center
View has left(and x) attribute in its LayoutParams.
How can I dynamically set the position of view in Android?
When left attribute is negative, it is hidden under the parent view.
If you want an animation, here is the document!
https://developer.android.com/develop/ui/views/animations/reposition-view

Sub View with 50% height of the space left between navigation bar & tabbar

I don't want to do this programatically. Please show me the storyboard way to achieve this.
I want orang view to of half size of the space between nav-bar & tabbar. Refere dashed rect, I want half of that rect.
There are a couple of ways to approach this that I can think of.
Use a container view
The first is to add a UIView to the superView to act as a container. You can "pin" this container view to the bottom of the navigation bar and the top of the tab bar.
Now add your orange view to this container. With constraints pinning it to the top, left and right. You can then give it equal height with the container and a 0.5 multiplier and it will have half the height between the nav bar and tab bar.
Use a "spacer" view
The other method is to use a spacer view. Add your orange view and then add another view beneath it. Pin them to the nav bar and tab bar respectively and give them a vertical spacing of 0 between them.
Now give them equal heights.
This will make them both take up half the space between the nav bar and the tab bar.
Now make the "spacer view" hidden. It will hide but the constraints will still work.
Both of these will work for any device size and any orientation. Also, for edge cases like if satnav guidance or an incoming call changes the height of the nav bar etc...
As #Fogmeister mentioned You can use spacer view
Pin both of them and make their heights Equal Height.
And set blue view Hidden.
Very easy, add the following constraints.
Left and right constraints pinning the view to the superview.
Top constraint pinning view to superview with a constant of 64 to offset the nav bar.
Equal heights constraint with the superview. Change the multiplier of this constraint to 0.5 and the constant to -54 (half of the 64pt nav bar + status bar and half of the 44pt tab bar) and update frames.
Job done. :)

move a subview down when scrolling UITableViewController

I have a UITableViewController with static cells.
I add a view in the lower left corner.
I wish for this subview to always stay "glued" to the lower left corner and come down/up with the user scrolling.
how can I achieve this?
Have a look at the link, it only requires very slight alteration to have a view stick to the bottom left corner instead of the bottom middle.
https://developer.apple.com/library/ios/documentation/UserExperience/Conceptual/AutolayoutPG/AutoLayoutbyExample/AutoLayoutbyExample.html

How to do multiple table view in scroll view

I am new to IOS, I want three table views in one view controller. when I scroll in horizontal it will move to table 2 and table 3. please help me in coding. how doing it.
Put horizontal scroll view with content offset width equal to 3 tables width then add uitableviews to that scroll view with proper x origin. Obviously it would be better to use NSLayoutConstraints for that, but the first way is o.k. for you I guess.

How do I make a wide PanoramaItem always align to left when swiping back?

So I created a bunch of PanoramaItems with Width of 600 and Orientation of Horizontal. When I swipe to the right direction the items align perfect on each item. When I swipe back to the left direction, it appears everything is aligned to the right side forcing me to swipe again to get my alignment correctly.
Is there a way to set the focus location of a panoranaItem each time someone changes their selection? Because it is odd to swipe once in one direction and swipe twice in the other.