Unable to close mergDataGridScroller in iOS - ios

This is what I'm trying to do: I've got two mergDataGridScrollers on top of each other. If I turn one of them invisible and scroll the other, I'm scrolling the invisible scroller because 1) it's not scrolling the intended scroller and 2) I can see the scrollbar of the invisible scroller scrolling.
So, I tried dispatching a "closeControl" to the invisible scroller, but that did not get sent because I think the command is private. Any suggestions on how to work with two overlapping iOS scrollers?

I haven't used mergDataGridScrollers but have used scrollers in iOS with groups - and in an app where I wanted an iOS scroller to slide on and off the screen I had to delete it, slide off the group behind the scroller and slide the group on again and recreate the scroller when I wanted it back. Showing and hiding the scroller didn't cut it for me (as you describe on a device if you do a swipe where the scroller was you'll see the scrollbar) - you'll presumably have to delete and create the scrollers anyway on leaving/entering cards on iOS.

The problem is there's a couple of bugs in mergDataGridScroller... I'll try and get a new version up ASAP

Related

XCUITests: Can't tap element on scrollview while views are stack on each other

Sample Project
This is a sample project that showing the issue. It's storyboard based, but method of building interface doesn't matter. It's UIViewController with UIScrollView for entire screen and 128 pts height view that is on top of this UIScrollView.
Inside scroll view there is an UIView that has 2000 pts height and UIButton in the center.
Initial State
After light scroll
At the bottom of UIScrollView
Link here: https://github.com/JakubMazur/UITestsDemo
Problem
I'm trying to tap this green button with XCUITest using app.buttons["Tap Me!"].tap()
XCUITest get identifiers from elements on screen for entire scroll view that works fine.
According to this reply on a thread on Apple Developer Forum written by Apple Framework Engineer I shouldn't scroll manually to get to the button and yes, this is partially true.
What is happening when code from (1) is executed is that button is scrolled just enough to be visible on screen but it's still not hittable, because other (purple view) is on top of UIScrollView
What is working
If I run a test written like this:
func testThatDoWorkButItsSlow() {
app.scrollViews.firstMatch.swipeUp()
app.buttons[buttonLabel].tap()
}
that is scrolling up and then looks for a button this will work, but it's slow and so inaccurate that is hardly usable.
What I cannot do
Disabling userInteractions on purple view. In real example I still need touches for this (purple) view.
Questions
Is there a way to use precise scrolling in XCTest for this case?
Or is there a way to set contentOffset scrollview to other value that will make this button more centered on a screen compared to action of tap()?
Or there is a way to fast scroll to the bottom (without animations) and maybe moving only up for each element?
My recommendation here would be to use the XCUICoordinate.press(forDuration:thenDragTo:) method to scroll.
https://developer.apple.com/documentation/xctest/xcuicoordinate/1615003-press
You can create a XCUICoordinate for the yellow view, then drag it slightly upwards to expose the button and make it hittable.
In most cases, the automatic scroll should work, but it seems like in this case a manual scroll/drag is necessary.
The UI Testing should replicate human interactions. You cannot expect from a human being to scroll "153px", you can just expect to "scroll until".
You can try something like :
while (!app.buttons["Tap Me!"].isHittable) {
app.swipeUp()
}
NB: You may also want to add a condition to leave the while loop if you can't find the button after a reasonable amount of attempts

Quick scroll by touching scroll indicator in UITextView

I'm trying to create the effect seen in some iOS apps where swiping the screen scrolls the ScollView/TextView normally, but sliding on the far right (where the scroll indicator is) creates a quick scrolling effect that allows the user to scroll through the position in the overall length of the view. For example, sliding on the far right from the middle of the screen to the bottom would take the TextView from the middle of its content to the very end.
Is there any pre-established way to do this, or is this an effect I would have to create from scratch?
Thanks a lot for any help, and I'm sorry if this question wasn't very clear.

WKInterfaceTable add scroll bar "flash' and remove scroll bar from non-scrolling view

I have two questions regarding WatchKit:
1) I have an app that uses [WKInterfaceTable]. One of the interfaces is scrollable.As such, when the user scrolls, the scroll bar appears in the top right corner of the watch interface.
How do I get the scroll bar to temporary flash the scroll bar when the user opens the app. A good example of this functionality is the Calendar app in Apple watch.
I've combed the net and WatchKit catalog (https://developer.apple.com/library/ios/samplecode/WKInterfaceCatalog/Introduction/Intro.html) but was not able to find a solution.
2) I have another interface that only shows one row on the watch and therefore does not need to scroll. How do I remove the scroll view in this case?
I am using WatchKit 2.0 and writing the app in Objective-C.
I wonder if you could get the desired effect by scrolling to the top programmatically after the view has loaded?
table.scrollToRowAtIndex(0)
If that didn't work, then perhaps (again after load) scroll to the second row and then back to the first to cause the bar to display?
table.scrollToRowAtIndex(1)
table.scrollToRowAtIndex(0)
I haven't tried this, but I have programmatically traveled to rows in a WKInterface table and I believe you do get the scroll bar.

UIAutomation and reading static text in scroll view

I'm doing some UIAutomation testing using Xcode Instruments and have an issue accessing a staticText which I want to verify.
The situation:
I have some buttons that display different scroll views that contain multiple charts. These scroll views have 5+ items in each so when i initially do target.logElementTree() it only shows the visible ones. If i scroll down with window.scrollViews()[0].scrollDown() and again get a logElementTree() the bottom elements are shown however whenever i try to access them it keeps referring to the ones from the top of the scroll view.
Any ideas?
Cheers.
As per as my experience, whenever you do "taregt.logElementTree()", it will display you all the elements (visible & hidden or which are present even at the bottom of screen) which you can access by its name or index or position once scrolled down. But if you still face problem, I will recommend you to access the element by its position after scrolling down to make it visible.

Fluid full screen view transitions on iOS

I have a simple app that has a set of coloured views, one red, one green and one blue.
I am trying to make it so that when a swipe gesture is made the current view will switch to the next one in the list in a fluid manner, it looks like moving a long piece of paper with different colours on it.
Is there a way to do this (CoreAnimation)?
You could first look into UIScrollView. It seems to me that what you are trying to accomplish is the same you have, say, in Mobile Safari on an iPhone, when you show all your current pages and can go from one to the next by scrolling. This tutorial is particularly close to what you describe.
If you are looking into more advanced kind of transformations, than Core Animation would be the option.
Actually, nothing prevents using both approaches, UIScrollView to handle the swipe, Core Animation to add more animation to the pack...
You could use a UIScrollView to accomplish this. Add all of your colored views as subviews to the scroll view. Make sure your contentSize is setup appropriately and optionally setup paging to make the scrolling always snap to a certain border. See the scroll view programming guide for more info Scroll View Programming Guide

Resources