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

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.

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

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

UIToolbar not resizing when rotating with autolayout, with UIBarButtonItems misplaced

it's the first time I'm seriously using autolayout so I'm sure I'm missing something obvious.
I have a very simple view embedded in a UINavigationController. There are three subviews: a UIWebView, a UIToolbar (which in turn contains three UIBarButtons) and a UIActivityIndicatorView. It's just a basic browser view, basically.
I managed to have everything appear as it should even on rotation, except for the toolbar: if the view is first loaded in vertical orientation, going landscape will not resize the toolbar from 44 to 32 points. Originally, before I wiped everything out, it did resize the toolbar BUT the built-in UIBarButtonItems appeared lower and cut off, as if the toolbar was still 44 points tall but pushed 16 points out of the screen.
If the view is first loaded horizonttaly, the bar is 32 points high but the built-in UIBarButtonItems appear still like that, and rotating to vertical will keep it at 32 points.
I honestly have no idea how to make this work as expected (ie. resize properly when rotated, with the buttons showing properly!), so if anyone could point me in the right direction -- pun intended -- I would be really grateful.
The activity indicator is right in the middle of the frame, with these constraints:
Align Center X to Superview
Align Center Y to Superview
The web view is set to use all available space from the top of the view (including the navbar) up to the top of the toolbar, and has these contraints:
Top Space to Superview
Bottom Space to Toolbar
Align Trailing to Toolbar
Bottom Space to Toolbar (it's actually listed twice)
Align Leading to Toolbar
The toolbar is a mess. It has:
Bottom space to Superview
Align Center X to Superview
Top Space to Web View
Align Trailing to Web View
Top Space to Web View (listed twice)
Leading Space to Superview
Align Leading to Web View
Bottom Space to Bottom Layout Guide
The problem is that by not adding any constraints at all, the web view is much bigger than it should be, and the toolbar doesn't even show.
I mostly set these constraints using the horizontal and vertical red bars (similar to springs and strouts) in the 'pin' popover for autolayout, but I'm starting to think that's not the most appropriate approach.
Note that I'm not trying to use autolayout within the toolbar, I read that it wouldn't work and I'm just using the built-in buttons plus a couple of labelled ones (those 'arrows' are really unicode characters, I may change them to prettier images at some point.)
Thank you in advance. :-)

UIScrollView Horizontal Scroll Thumb in the Vertical Track

If an insane client had asked for this functionality, I would have told him it was impossible.
Yet here I have your everyday UITableView inside a UIScrollView, setup in Interface Builder. The scroll view has vertical scrolling enabled, but not horizontal. So what the heck is THIS:
Note the bottom right -- that capsule is the visible scroll thumb in a horizontal orientation. If you scroll the table view up and down, that thumb moves left and right... INSIDE THE VERTICAL SCROLL TRACK. The width of the track is the complete representation of the height of the scroll view's contents; I scroll to the top of the table view, and the thumb moves to the left, so I can just see the right side of that capsule shape.
This has to be some kind of weird bug, right? Any ideas how to shake this loose?
Looks like I posted too soon. I deleted the table view in IB and re-created it. The problem went away. Must have been some glitch in Interface Builder.

How do I expand a window to show more content in cocoa

I'm building an application in Cocoa and I want to be able to let the user click a button, which expands the window size showing content that was previously hidden.
For example, the top 68 pixels of my application show a summary of what is happening (like syncing data to a server) and there's a button off to the right that when clicked expands the window down and let's the user enter more information.
Problems I'm having are.
1) the background image I setup by subclassing NSImageView seems to be originated at the bottom left corner instead of the top left, so my button which should be over the right corner a the top of the background starts off over the right corner at the bottom of the background.
2) The window expands down and the button floats up. So the button starts at the bottom right corner and ends up at the top right corner. I want it to be in the top right corner always.
I think all of this would be solved if I could figure out how to tell the window to start at the top left corner and grow down, but not move controls around, simply hide them if the window isnt big enough.
Thoughts?
If I understand your question right then this should be it:
1) it is so because the coordinate system on mac is with the origin on bottom left. I think you should just move your image view up a little when you're resizing.
2) When you expand the window the buttons frame is based with the origin on the bottom left corner so again you will need to offset it when the view grows.
I think that by using auto layout and setting up the proper constraints things might be a little easier :)