How to slide tableCell to show hidden interaction in UIAutomation iOS 7 - ios

I am trying to figure out how to get a hidden button to appear on table cell. Similar to if you were looking at the SMS app on iPhone. The threads are in table cells and if you touch and drag across that cell, a button to delete that thread appears. The functionality in my application is similar.
Now I would like to automate the testing of being able to delete a thread with this method.
target.frontMostApp().mainWindow().scrollViews()[0].tableViews()[0].visibleCells()[0].dragInsideWithOptions({startOffset:{x:0.9, y:0.5}, endOffset:{x:0.0, y:0.5}, duration: 1.5});
The above currently seems to start the intended interaction, but then the UI snaps back as if the action did not happen.

If you run this manually, does the cell stays on one side or does it always snaps back? The reason I ask is because I have a similar UI but I'm able to slide the cell all the way to one side and then tap on the buttons behind it. If you only drag the cell half way, then it will ignore the taps.

Related

I get wrong indexPath in the didSelectRowAt when the keyboard of the UITextView is dismissed by taping on the background

I have a tableView. The last row of which is the UITextView while the 2 cells above are clickable(Another viewController appears by tapping on them). When I begin editing the textfield a keyboard presents so the upper cells do not fit in anymore and we do not see them.
Then I decide to hide my keyboard by tapping on the background.
The problem is: when I tap on a certain point didSelectRowAt is called. This 'certain' point is any point which appears within the borders of the 2 clickable cells described above.
It seems like after dismissing the keyboard and restoring the initial UI a gesture of touching is recognized and the system thinks that the cell was selected.
Who had experienced this problem before? How can I cope with that bug? Please share your experience
This question is not clear. You get wrong index path selected or you don’t want any selection at all?
When you show keyboard and update UI, you can disable any selection in the table. After you’re done with the keyboard, you can enable it again.
https://developer.apple.com/documentation/uikit/uitableview/1614911-allowsselection

How can I change the behaviour of selecting a draggable cell with VoiceOver in Swift?

I'm very new to iOS and accessibility but I am trying to write an iOS app for visually impaired people that will also be user-friendly for sighted people.
It involves the moving of cells from one UICollectionView to another. The second UICollectionView is like a big square grid of cells and I have implemented drag and drop for sighted people. However, for blind people, I need some other way to move the cells as my testers, who are blind, tell me it's unlikely for them to use a drag and drop app.
The problem is if I turn VoiceOver on, the double tap gesture does nothing. If I double tap and hold, it selects a cell to be dragged, rather than just selecting an item to be moved and waiting to be told where to move it.
Is there some way to have drag and drop for when VoiceOver is off plus a different approach to moving the same item if VoiceOver on?
You can find some information about Drag & Drop using VoiceOver in the What's New in Accessibility WWDC 2017 video with a perfectly detailed summary.
accessibilityDragSourceDescriptors and accessibilityDropPointDescriptors seem to be the most important variables to be used.
I never implemented it myself but this site is the first place I would go to find the proper way to do it.

iOS UITableView Editing with Accessibility

I am working on an app that supports Apple's voice over accessibility option.
I have a screen with a tableview that has an editing state for the tableview in which the user can swipe and/or tap the red delete button at the beginning of the table view cell to delete the cell.
All of the functionality works fine with voice over turned off, but when I turn voice over on, the delete button is not in the swipe order, nor can you tap it.
Is there something special I need to do to enable the user to tap/swipe the cell while voice over is enabled?
I ended up figuring this out.
Apparently the way the voice over works with editing commands on table view's is that once the cell is highlighted, you can swipe up and down to go through the custom action commands. Once the command you want is spoken, you can double tap the screen to execute the command.
It's a little confusing since the delete button on the cell is never highlighted, which was what was throwing me off.

Move a button from one UITableViewCell to another with animation in Swift

I have a button and I want to keep track of which cell has the button with firebase. I can do this by putting the button in all cells and just make it visible in the one cell using firebase data. The part I'm stuck on is animating the button to move from one cell to another.
The only way I can think of is to put a delay on moving it from one to another, then have a separate animation happen. Then I think if I make the delay the same as the animation's duration then it will look like it just moved. I just thought of that while typing this but let me know if there's an easier/better way please!
This is a pretty tough thing to do, and animations can sometimes be one of the most difficult parts of mobile development. You aren't super clear on what your animation should look like, but since UITableViewCells each have their own contentViews I don't think directly animating the button from one cell to another is possible.
The best method I could think is to:
1) Draw a button on the screen at the location of the button you want to move
2) Hide the real button underneath
3) Animate this fake button over the tableview to the spot of the new, real button
4) End the animation and show the real button.
But you might have to block user interaction with the tableview while this happens to prevent them from scrolling and screwing up the animation...

How to implement newsfeed comment page similar to Facebook or Instagram

Both Instagram and Facebook allow their users to comment on news feeds. In the comment scene, they basically have a UITableView with all the comments and a “footer” where user may enter comments and post them. So the “footer” is a UIView or UIToolBar with a UITextField/UITextView and a UIButton. Truly simple stuff from the look of it. Well I have been trying to implement it and the keyboard is not cooperating. I need the keyboard to not hide the “footer”. Especially now in iOS 8 the keyboard comes with a suggestions tool bar that a user may choose to show or hide. All these interactions make it difficult to keep my “footer” right above the keyboard while user is entering text. Every time I think I nail the solution, I find a multitude of bugs.
In one implementation, I use keyboard notification to listen for when the keyboard is up or going down (partly based on iPhone Keyboard Covers UITextField). The problem with this implementation is that there is a lag of about 1 to 2 seconds for when the keyboard shows up and for the “footer” to climb to the top of the keyboard from the bottom of the screen. A second issue is when user drags the suggestion toolbar to either show or hide it while typing, it causes my “footer” to move in unpredictable manners: which means I will need some static variables to meticulously track cumulative interactions with the suggestion toolbar just to fix that bug. Also notice that I put “footer” within quotation marks. That’s because I am not referring to a UITableView footer. But rather a view that I create beneath the table view as suggested by UITableView, make footer stay at bottom of screen?
Another implementation I tried was to use a “footer” and a keyboard ToolBar. When user clicks on the UITextField of the footer, that would cause the keyboard to show up with a replica of the footer as inputAccessoryView. This is basically to visually fool the user into thinking it’s the same footer that seamlessly climbs with the keyboard. But in reality I am using two compound Views: a “footer” and a keyboard toolbar. The first problem I encounter with this one is that I cannot seem to make the tool bar text field the first responder programmatically. This actually used to work in ios-7. But since I updated to iOS-8 it does not work. So if I do footerTextField.inputAccessoryView=keyboardToolBar and then in the textfield delegate method check if(textField==footerTextField){[tooBarTextField becomeFirstResponder];}, iOS-8 just ignores the whole thing or, worse, dismiss the keyboard and the toolbar altogether, so that in fact the keyboard never shows up when I click on footerTextField since the showing and dismissing happen so quickly.So again this used to work in iOS-7, but in iOS-8 it does not work.
a third approach was to make the parent view a TPKeyboardAvoidingScrollView such that I would have parent, and children UITableView and “footer”. Here while TPKeyboardAvoiding have worked for me on other scenes in the app, for whatever reason it’s not working here. My guess is because I am using a UITableView as one of the children of a UIScrollView.
a forth approach was to make my “footer” an actual UITableView section footer; section footer because I want it to float at the bottom. The problem with section footer is that they don’t stick to the bottom, which gives a visually erratic user experience as you scroll the table.
Ok, so I have said a lot. So finally, has anyone implemented a scene similar to Facebook’s/Instagram’s NewsFeed Comment scene? If so, will you please help me?
To recap: the Facebook/Instagram input textfield grows with text; sticks to the top of the keyboard whether the keyboard's suggestion toolbar is showing or hidden; sticks to the bottom of the screen when the keyboard is gone.
SlackTextViewController seems to fit all your requirements and is very well-written.

Resources