Scrolling by hiding scroller in GtkScrolledWindow - gtk

I have a gtkscrolledwindow object which sets to GTK_POLICY_NEVER for both horizontal
and vertical scrollbar. I have placed one button on each side of it. My requirement is
when i click left button all the elements should scroll left and vice versa for right
button. So, on what ways this requirement can be achieved.

This can be achieved by using Adjustment associated with the scrolledwindow. get the adjustment object from scrolledwindow and set the new value for the adjustment then scrolling effect will come into effect. within the scrolled window you can add any number of widgets....

Related

How to perform an interactive animation with Auto Layout in which you interpolate between different constraints?

I'd like to have an interactive animation where a view transitions from one set of constraints to another as the user drags up/down the screen. The background image should shrink vertically (easy), and the profile image should change from being horizontally and vertically aligned to the background image to being anchored to the top and left corners of the background image. Is this possible?
Yes, it is possible, and you can see this effect in the Avvo app, for example (in the lawyer profile screen). The trick here is to smoothly transition from one set of constraints to another.
Here's an outline of how to do this:
add a UIScrollView. Add the view you want to animate as a subview to the scroll view.
Make your view controller implement
UIScrollViewDelegate
In the delegate method
scrollViewDidScroll(_:), update the constraints' constants as
needed.
Also in that method, when contentOffset crosses a
threshold value, flip to a different set of constraints, by setting
their active property to true or false.
To keep the view (the headshot image, in my example), pinned to the top as you scroll, just continuously update its top spacing constraints based on the contentOffset.y value.
Achieving a perfectly smooth transition may take some trial and error, but it definitely can be done!
Here are the screenshots showing the transition as you scroll up:

How to use a scrollview containing buttons with auto layout

I need some help figuring this out.
I have a simple UI I need to implement. I have 4 buttons that take up the entire screen and with the scrollview, I want the user to be able to scroll to make the 5th button visible. I know how to use auto layout to make my first four buttons display how I want them. The first button is 40% of the visible screen, the second button is 15%, the third 30% and the last button is 15% of the visible screen. The 5th button should be hidden but then revealed when the user scrolls down.
(To clarify, all buttons have width equal to their superview, proportional height to the superview and all buttons have no spacing between each other)
This is where I am stuck. I want the proportions as I stated above, but also want the 5th button to show when scrolled to, possibly at 10% of the now visible screen (with the first button now not showing itself fully). Is there a way to do this?
You can set the contentSize of the UIScrollView to be larger than the visible screen. The buttons can be sized and placed in a way to have all 5 buttons visible (with the 5th button actually off screen). The scrollView will bring the 5th button into view when scrolling.
I worked up a simple prototype using just a storyboard (and setting the contentSize of the scrollview in Runtime Attributes section, but this could be done in code if you need to pragmatically determine the button sizes.

How to preserve constraints for hidden views within UIStackView

I have three buttons within a horizontal stack view and I have set the autolayout up so they appear based on certain criteria.
For example, first button will be 40% of the stack view width, second button has the same width as the first button, and third button takes the remaining width. Height of the buttons are the same as the stack view. They are all spaced equally, 8 points apart. Stack view's distribution is set to to "equal spacing" and alignment is set to "center".
The issue appears when I decide to hide the first two buttons, but still would like the third button to appear in the same spot with the same width. Autolayout would resize the third button as if the first button and second button are not there.
How do I make it so the autolayout created continues to be preserved as if the hidden buttons are still there?
Couldn't you just set the alpha to 0 and userInteractionEnabled to NO for the buttons you want to "hide"? This would cause them to disappear, and I don't think that it will cause the third button to expand.
Use a second constraint to the container that can act as a backup constraint. Or just re-recreate the desired constraint via code.
I have one more better solution. Add the three UIView in stack align as per your need, then add the button in every UIView. Now you can play with button hidden true/false, here UIView will always be with clear color. Alignment won't change.

How to set the scroll view position so as to display the new instantiated ui panel in the ui scroll view in ngui

My question is related to ui scroll view in ngui
I have a set of panels in a scroll view that move horizontally.
I use NGUITools.AddChild to add a new panel.
I position this new panel to the end of the scroll view.
The problem is that i want to move towards the new panel that was created and placed at the end of scroll view but i am not able to find a proper solution to this issue.
I tried to move the whole grid manually but then the scroll view would move to some other place leaving the camera's view as the offset values get changed when i move the grid manually.
I tried to move the camera but the same issue occurred.
I tried using UIScrollView.ResetPosition() but this actually changed the scroll views position to the top left corner i.e the first ui panel child in scroll view.
But i want to move towards the last ui panel child in scroll view.
Is there any class available that sets the position of the scroll view to a particular panel.
I want to move the panels or the camera whatever is feasible to display the panel i want to without affecting any offset values and the on drag values.
Thank you for reading.
You can use UICenterOnChild.CenterOn(transform target) to center the panel to a specific target: http://www.tasharen.com/ngui/docs/class_u_i_center_on_child.html

Appending a scrollview (horizontal) to a view which has a scrollview (vertical) and two labels Iphone sdk

I have developed an iphone application which has 6 cards (icons with images) in the Rootview. Clicking on a card would bring another view which the image being enlarged (fullScreen). The Card View has a Flip button which shows the back side of the Card which contains some text. Different cards hold different text on their back. Depending on the text size the view will be scrollable. I used two labels: one for title of the text and and second label having the whole paragraph. I have placed a scrollview below the two labels for vertical scrolling.
When a nth card is clicked from the Rootview the selected card should appear. It works perfectly. I used a separate view to design the front view of card and a different one for the text on the back. The issue is when a card is opened and flipped to see the text, it should be scrollable horizontally too apart from scrolling vertically. I dont want to redo anything. I have placed the vertical scrollview and the labels on the view representing back of card. I added another scrollview and enabled its paging property and wrote code in the following functions.
scrollViewDidScroll:(UIScrollView *)sender;
scrollViewDidEndScrollingAnimation:(UIScrollView *)newScrollView.
But it is not working as desired. No scrolling works (even the vertical 1 which was earlier working fine. I mean when i combing the horizontal scrolling both stop working.
How do i allow vertical and horizontal scrolling to this view which has two labels.
I would appreciate your help...
Thanks in advance
I solved it.
I used a table view to hold the card back details. So i get vertical scrolling by default.
I took a scrollview which will hold as many number of tableviews as there are cards.
And it is done