[watchOS] tap table row -> segue to page navigation

Discussion in 'iOS Programming' started by patent10021, Aug 9, 2018.

  1. patent10021 macrumors 68030

    patent10021

    Joined:
    Apr 23, 2004
    #1
    Sure be nice to have a watchOS programming forum.

    The idea is to tap an image in a table row which triggers a modal segue to page based navigation to present a kind of photo slide show. For now I am using a button to trigger the modal segue into the pages. It works as expected.

    I've tried segueing from an actual WKInterfaceTable to these same pages using
    didSelectRowAt rowIndex and it takes me to the first page but I cannot swipe through all pages since in watchOS we cannot mix hierarchical navigation with page navigation.

    Screenshot
    https://imgur.com/a/zHYWkEH

    What do you suggest?
     
  2. jgaz macrumors member

    jgaz

    Joined:
    Dec 30, 2007
    Location:
    Colorado
    #2
    I know the frustration well. I have wanted to mix the navigation types as well. Could your slideshow scroll vertically with each cell being the same size as the screen? You can use a WKPanGestureRecognizer and the WKCrownDelegate to not allow cells to be partially scrolled through but animate to the next complete cell after the pan or crown rotation have exceeded some threshold. I ended up doing a similar thing to create an interface similar to the one in the Music app which allows you to scroll through albums covers.
     
  3. patent10021, Aug 13, 2018
    Last edited: Aug 13, 2018

    patent10021 thread starter macrumors 68030

    patent10021

    Joined:
    Apr 23, 2004
    #3
    ok well let me ask you this. The watch faces navigation has no pagination dots on the bottom yet we are able to swipe left and right. Same with the Calendar app. We can swipe through various screens left/right. Is this just normal hierarchical nav via gesture?

    Here is a more detailed set up you may have seen before. I am attempting something similar in UI design.
    https://imgur.com/a/ORtgiUB

    This is obviously a table with each post in its own row cell. Each cell contains a single user's photos and post text plus like glyph and comment glyphs.

    Now here is the unknown. Each post actually might have 0-9 photos. But I have chosen only to display only the first photo since it looks cleaner. It might contain 0 photos in which case only the post text would be shown. (That in itself is another challenge).

    GOAL: I want to be able to swipe left/right multiple post photos if there are some. But at the same time be able to scroll down/up to view other different posts.I guess like the weather app or the music app you were saying.

    Are you saying I can accomplish this using your method?

    In iOS that navigation is done via collection view. But watchOS has no collection view.
     
  4. jgaz macrumors member

    jgaz

    Joined:
    Dec 30, 2007
    Location:
    Colorado
    #4
    for swiping left horizontally it seems to be built in to be able to swipe back to the parent screen but not forward (the os wouldn't be able to guess what data should be passed to the child).

    If I am understanding you correctly vertical swiping scrolls between posts and horizontal between photos in a post?
    If that is the case you can definitely achieve this with the hierarchical navigation. I would probably set up your post cell with the following structure:
    PostRowController:
    MainRowControllerGroup:
    ImagesGroup:
    Image1
    Image2
    Image3
    Image4
    Image5
    Image6
    Image7
    Image8
    Image9​
    TextGroup:
    Label
    ...whatever else maybe icons​

    Unfortunately with WatchKit you have cannot add UIelements at runtime so every PostRowController will need the maximum supported number of images per post. The ImagesGroup should layout horizontally and the images should have fixed sizes so that only one can be shown on the screen at a time. Then you can add a swipe gesture recognizer to the images group to show the next or previous image by either using setHidden(false) on previous image if you want to show it or setHidden(true) on current image to show the next one. You can put these in an animation block to animate smoothly between them.
     
  5. patent10021, Aug 14, 2018
    Last edited: Aug 14, 2018

    patent10021 thread starter macrumors 68030

    patent10021

    Joined:
    Apr 23, 2004
    #5
    cool

    One other question.

    Can I have a main MenuVC in the middle and swipe to the 4WheelVC and to the right WingsuitVC from the middle MenuVC while at the same time there are also menu buttons?

    The reason is I want the two most important VCs to the left and right of the middle MenuVC because people like to access those areas the most.

    Like this:
    https://imgur.com/a/y8kt1N6

    And from the BungeeVC can I use gestures to simulate paging without the pagination dots to go to VC1 and VC2?
     
  6. jgaz macrumors member

    jgaz

    Joined:
    Dec 30, 2007
    Location:
    Colorado
    #6
    yeah you can grab the pan gesture and use it to navigate.
     
  7. patent10021, Aug 17, 2018
    Last edited: Aug 17, 2018

    patent10021 thread starter macrumors 68030

    patent10021

    Joined:
    Apr 23, 2004
    #7
    So if we can do the same thing via gestures is there really a need for paging? EDIT: But gestures need a container right? i.e. you drag a gesture into a UI element. You cannot just drag a gesture onto an empty view. But with pages it can be an empty view. Is that the difference?

    Btw, I've been watching some WWDC videos but there do not seem to be any new navigation api changes. Mostly notification grouping and notification action replies etc. Any new ui navigation changes?

    p.s. with watchOS 5 is it possible to make video calls or is that only a private Apple api? And there is the new walkie-talkie app? Is that only audio? Can our apps have the same functionality?
     

Share This Page