How to move accessibilty focus from UITableViewHeader to Cell in UITableView in iOS - ios

I have one UITableView where I am adding a header using UITableHeaderView.
The header view is occupying fit to screen in small devices because of its content. And in accessibility it's not moving from table header view to table cell since those cell are not getting visible in screen.
This is working fine in iOS8 but not in iOS9.
I know accessibility post notification should work, but not sure where to fire the notification since there is no way to know that content reading done for table header view.

I would like to answer my own question. I fixed the issue by using accessibilityElementDidBecomeFocused. I checked for last label in header view whenever receives i scrolling table on tab so that other cell could get visible and voiceover can move to next element.

Related

iOS Accessibility Voice Over not working as expected in table view with tall header view

I've got a table view which is displaying detail information about a session at a conference (think WWDC or Google I/O). The bulk of the information is in a flexible-height header view, but there is a need to link to an arbitrary number of speakers and related sessions. This is accomplished with individual table view cells. So the structure of the page is a very tall header (over 1000pt), followed by lists of speakers and other sessions in cells.
The problem I'm encountering is getting accessibility voice over to work properly: when you advance the voice over down the content to the bottom of the header view, the first cell hasn't dequeued yet. Since the cell and its content don't exist, the voice over targeting just jumps to the tab bar at the bottom of the screen. If you manually scroll the table view down so that the first cell is visible, then turn on voice over, the stepping works as expected, since every cell is pulled up high enough to cause the next cell to dequeue.
How can I cause the voice over accessibility stepping to cause the table cells to begin dequeueing so that voice over continues all the way to the bottom of the dynamic content?
There may be a more correct way to do this, but at the suggestion of a co-worker, I tried making the table view taller than the header in viewDidAppear and set the content and scroll indicator insets so that it still looks like it did before. This has the effect of forcing the cells to begin dequeueing immediately, which allows voice over to flow all the way through the content.

UITableViewController with static cells: invisible cells when keyboard shows

I am using a UITableViewController with static cells, as a user details form. Everything works, until I tap in one of the cells's text field, the keyboard (or custom inputView) shows up, and you scroll the table down. Cells are then not shown, instead a blank space is shown. Scrolling up and back down then correctly shows them.
If I scroll the tableview down until the "geboortedatum" field shows up,
and press on that textfield, a custom inputView with a date picker shows up:
Now, if I scroll the tableview down, the next rows show up blank:
Two rows are supposed to show up there, like this:
It's not related to the inputView with the date picker, the same happens when the plain old keyboard shows up and you scroll the table down.
I have not overridden any of the tableview delegate or datasource methods apart from showing custom headers (but the problem is the same when I remove that), and am not using UITableViewCell subclasses, just static cells in a storyboard. It seems like an iOS bug to me, but is there any way to work around this?
I think I found the cause and the solution. The problem is that these last 2 cells don't actually fit in the storyboard design:
They are there of course, just not visible by default. If I change the storyboard to freeform with a custom height to make it all fit, like this:
Then the problem doesn't show up anymore. The cells are not hidden anymore on scroll, as before. Very strange.

UITableview with Autolayout and NSFetchedResults controller cell layout bug on insert

I seem to be having a very strange problem with my UITableview cells and autolayout. So my tableview is set up as follows:
I have a UITableView within a UIViewController that I created via Interface builder using Autolayout
My tableview is using UITableViewAutomaticDimension so that the cells can resize based on the text within them.
Each cell has 2 subviews within it. A front view and a back view. The back view contains the buttons for my slide-able cells
I am using NSFetchedResults controller to update the tableview
The problem occurs when I tap on a cell and am taken to the next view. Then I create a core data item within that view and save so that it is inserted into my tableview (now behind the current view controller).
What happens is that the newly inserted cell seems to lose all autolayout constraints and all view elements are on top of each other in the top left of the cell. It also looks like they are not even contained within the front view for the cell (or the front view has a width and height of 0).
Example:
It gets even stranger. If I refresh the tableview by pulling down and the cells are reloaded it corrects itself. However, if I refresh the tableview again then the problem appears again but on a different cell. This bug does not happen consistantly which is rather frustrating.
Any help would be appreciated as I only have a few remaining hairs on my head to pull out at this stage.
Thanks in advance!
So I found out what the issue was. The issue was that I was using size classes in Interface builder but I was only using the iPhone Portrait size class and did all my work in there instead of the "any" size class. Disabling size classes and setting the project to iPhone only fixed all these problems.
Weird I know

UITableView with header works incorrectly for any view except UISearchBar

I have standard master-detail navigation based app with first VC as UITableView. I want almost standard UITableView with custom tableHeaderView (UISearchBar enhanced with additional button).
First I have tried to set UISearchBar as header view and everything works just fine.
But when I set a custom view (even simple empty UIView) as tableHeaderView, table begins to behave wrongly:
Header view scroll offset is not adjusted automatically (i.e. header not automatically slides up or down)
When push to another view controller happens, UITableView scrolls to Zero contentOffset, which is noticeable by user
This is strangle because UISearchBar being set as header should not affect tableView scroll logic.
Maybe apple uses some hidden APIs?
Anyway, is there a way to make custom header that works smoothly like with a SeacrBar (without side effects)?

UITableView Section Headers not visible when table in visible rect

I have a UIScrollView with 3 UITableViews stacked horizontally. I switch between these tableviews using a tab-controller on top. However, when I switch to the 2nd or 3rd tab and switch back quickly to 1st the section headers don't show. They display when I scroll the tableView. These are custom headers (jfyi). I tried calling setNeedsDisplay when the tableView is visible, but that does not help because as per Apple Docs :
If you simply change the geometry of the view, the view is typically not redrawn. Instead, its existing content is adjusted based on the value in the view’s contentMode property. Redisplaying the existing content improves performance by avoiding the need to redraw content that has not changed.
Since, only the geometry of the view is changing here, it does not help. Also this happens on all versions iOS 5~6.1 and on simulator and device. Thankfully, this does not crash the app, but its a problem nevertheless. Could someone help? I am attaching pictures for reference. First shows the problem, second: after scrolling the "head(er)less" tableview
EDIT:
I am using simple scrollRectToVisible:animated: to switch between tableviews. This does the trick but I just observed that when I set ...animated:NO all is okay. The problem happens when ...animated:YES
It seems the issue of displaying and scrolling taking place simultaneously for the respective tableview. So what you can do here is:
Remove the scroll animation
or
Just scroll the tableview to top on the tab press event
or
simply reload the tableView which is made visible

Resources