WatchOS snap to next row on scroll in WKInterfaceTable - scroll

Apple's own Activity app has an interesting feature that I try to re-implement in my own watch app: Each page in the activity app is scrollable and basically has 2 vertical pages. The first page is the circle and the second page shows more information.
But these pages don't normally scroll up and down when using the digital crown - they snap. So you can't scroll in between pages. Apple seems to be using a WKInterfaceTable with two rows but I don't find any documentation how you can implement the snapping behavior.
How did they do it?

You can use WKInterfaceTable's - (void)scrollToRowAtIndex:(NSInteger)index to scroll to a specific row. To get feedback from the digital crown directly you'd have to use WKInterfacePicker, but that may or may not work in your case.

Related

how to do a horizontal carousel layout in nativescript?

As the picture above demonstrates, I want a layout that could contain A,B,C 3 sections. But only section B would be visible, A & C should be hidden, but when user swipe on section B, they could see the content of section A or C. I know ScrollView could do this, but I don't want it to be scrollable to the user. I want to programmatically control the behaviour when user swipes on it. Similar to the carousel. I have tried normal layout like GridLayout, FlexboxLayout...they all will contain the elements in the page, they just didnt let them overflow. So anyone has any idea on how to work around on it, please let me know, thanks.
I would recommend using nativescript-carousel (https://market.nativescript.org/plugins/nativescript-carousel) to achieve this. I think that is pretty much what you are after - just hide the indicator (dots). There are demos on that page for how to use with vanilla javascript, angular, or vue.
It makes use of DKCarouselView for iOS and ViewPager for Android.
You can also hook onto the slide tap and change events easily enough, which is all in the demo usage instructions.

What is this mobile navigation pattern called?

What is this mobile navigation pattern called? I need to replicate it but I dont even know how its called.
I need to replicate it in the mobile version of a responsive website. I believe its used in many native apps, its a "carousel" style navigation, where you slide the nav sideways in orther to access the other options.
Mobile subnav
I believe this particular pattern is called Horizontal Overflow. You can find an example of it under Brad Frost's Responsive Navigation Patterns (along with a ton of other great patterns) here:
https://bradfrost.github.io/this-is-responsive/patterns.html#navigation
In Android/Material Design that's a Tab.
https://www.google.com/design/spec/components/tabs.html#
There is no identical native control on iOS, the closest thing is a Segmented Control placed at the top of a view.
https://developer.apple.com/library/ios/documentation/UserExperience/Conceptual/MobileHIG/Controls.html#//apple_ref/doc/uid/TP40006556-CH15-SW27
Their usage varies on the two platforms. On Android tabs navigate among a number of views, where on iOS top aligned Segmented Controls often provide a filtering function on a single view.
iOS has Tabs too, but they're properly positioned at the bottom of the screen.

My WatchKit wkinterfacetable won't scroll

Despite having more elements than fit the screen I can't seem to get a scroll behavior via touch or scroll wheel in the simulator or actual watch.
Tables don't behave properly when nested within a group. Remove the group and your tableview should scroll.
The HIG also mentions not to do this: https://developer.apple.com/watch/human-interface-guidelines/ui-elements/
My one wasn't scrolling because I had "Fixed to screen edges" enabled in the storyboard for that interface controller. Make sure you have that disabled.
I found 2 solution for the table scroll issue in watch app.
Remove Table from the Group
Other solution that works for displaying indicator is to set Group Size to "Size to fit content"
Screen shot attached for the reference as well.

Animating page navigation in WP 8.1 while the current page stays still

In WP 8.1 Store app, how can I change page animation upon navigating to another page within the frame such that the current page stays still while the new page is animating on top of it by moving from the top of the screen to the bottom?
I'm currently animating my navigation like so:
protected override void OnNavigatedTo(NavigationEventArgs e)
{
Frame.ContentTransitions = new TransitionCollection
{
new PaneThemeTransition{Edge = EdgeTransitionLocation.Top}
};
}
But this is animating both pages by moving the current one from bottom to top while the second one simultaneously moves from top to bottom. I'm also seeing a black background while the pages are moving for screen area that's not occupied by any content.
You unfortunately can not navigate to a different page and keep the previous page visible during the animation. That is why all page Transitions right now only support an In-Transition and an Out-Transition. We discussed the issue with Microsoft developers during this years //Build so I'm certain of this information.
If you really need that effect you can perhaps achieve it using a workaround. Instead of placing your content on separate pages you would create user controls and animate those while staying on a single page. This however can be a little tricky due to you manually having to manage "navigation" between the user controls instead of having the system deal with it for regular pages.
More information on how to implement animations in Windows Phone Silverlight Apps can be found in this article: http://msdn.microsoft.com/en-us/library/windows/apps/jj206955%28v=vs.105%29.aspx
I had a similar problem a while ago and it is kind of a workaround as well but it might do the trick for you.
You can place a Frame object taking all the available space on your current page. Then, instead of navigating from your current Page Frame, you navigate from the Frame object you put on top of your actual page.
The problem with this approach is that you would really "get rid" of the first page.
But this can work for you, or at least give you another insight of the problem.

How i Scroll web browser control in wp7

i want to swipe webbrowser Control which is on pivot item ,each pivot item
has a web control .i want to swipe with web browser control .
but i don't have any idea.but swiping is necessary in my project .is there any method to doing this if yes then please send me sample code for this ..
This is a bind if you have some different sections of HTML you want to display in a Pivot. If you are targetting WP7 Mango it might be possible for you to convert your HTML to RTF and then use a RichTextBox instead of a WebBrowser. However if your HTML is fairly complex, this probably isn't going to work for you.
Alternatively you could place your WebBrowser in a pivot item with a transparent Rectangle above it in the Z-order. Make sure that Rectangle swallows any gestures and doesn't pass them through to the WebBrowser control - that way you will be able to swipe left and right on the WebBrowser to get the pivot to move.
Next you can use the GestureService on this transparent rectangle to recognize vertical pans/swipes and taps to take you to a full page view of your WebBrowser content. In this full page view you would have a fully interactive WebBrowser control.
You have an issue with competing gestures. Try setting the WebBrowser control to IsHitTestVisible to false. This will mean that you'll be unable to manipulate or scroll the content of the WebBrowser control though.
shanu: if you still need it, check my recent answer at: WP7 Pivot control and a WebBrowser control
There's a bit of info on how to "hack into" the webbrowser and what to do, to (almost) prevent it from stealing your swipes. If you are insane/masochistic enough to try that approach I described there, then in addition to that eventhandling and other configuration/detection, you will have to drive your pivot manually via relevant pivot.selectedindex++/-- on H-swipes detected with your handlers (or you can separate blocking and observing with gesture listener, that may sometimes result in the code being a bit cleaner). I also think you will have to be careful with the selectedindex near to the page ranges. I dont know how pivot behaves if you order it to go further than you page count, and I dont know either if it will animate correctly, if being on the last page you order it to go "wrap around" and go to page 0 via selectedindex=0. It may get "crazy" and rewind back instead of going forward in a circular fashion.. you will have to experiment with that

Resources