UICollectionView Section Headers as Accessibility Headers - ios

I have two questions regarding accessibility and UICollectionViews that I'm hoping to get some expert help with. The other question, regarding Voice Over read order, is here. I've created a sample project demonstrating both issues.
I have a UICollectionView where I'm providing custom section headers. These section headers are accessibility elements and have the accessibility trait UIAccessibilityTraitHeader set. When Voice Over is enabled, and the user is swiping horizontally through the collection, the header is announced properly, and it is even declared as a header. However, if the user swipes up or down to the next header, Voice Over will only jump to another header if it is visible. I'm assuming this is because when a view isn't visible in a collection view, it's removed from the view hierarchy and Voice Over no longer knows it exists.
You can pull this example project, run it, enable voice over, and use the dial to set the swipe up/down to headings to view the issue.
Is there a way I can allow the user to jump to a header that is not currently visible? Any help would be greatly appreciated.

You might have to use the scrollToItemAtIndexPath:atScrollPosition:animated: property of the UICollectionView to scroll the header into view before VoiceOver can read it.
You can find out which indexPath you are currently at via indexPathForItemAtPoint: using the position of where they touched within the collection view and then you know which section comes after.

Related

Swipe to delete tableview section [duplicate]

I am working on extended data and a UITableView. I am able to use swipe to edit and delete functions. I am wondering if it is possible to swipe and delete only section headers. If yes, how?
I am not sure what you want to achieve.
But if you want to have a swipe delete for a section header, the answer is, you can do it, but it requires some kind of programming. Essentially, you had to add a „section header delete button“ as a subview to the table views content view.
I suggest reading Ray Wenderlichs tutorial „How To Make A Swipeable Table View Cell With Actions – Without Going Nuts With Scroll Views“. This demonstrates how you can add swipe gestures to a table view cell.
However the same techniques (e.g. controlling the position within the scroll view) can be applied to a section views header.

TVOS about App layout (Like in iTunes and similar)

I have played a lot with my app and I do not understand how to make layout like in for example iTunes (also many apps uses it).
How it is made? It is one big CollectionView, but with special Flow or it is TableView with many CollectionView?
Collection headers. In iTunes App if I select item (with adjustImageWhenFocused) under the header then the header will jump up and the item will not overlap the header. It is special magic or it is system behavior and I just do know how to use it?
Below is two screenshots about what I am trying to tell you and example with my app.
In iTunes there are movie preview page. With what type of View it is made? TableView,CollectionView or just ViewController with ScrollView?
I have read many sources and looked up demo projects, but nowhere I have found answers for this questions.
1) I think it would be a stackTemplate containing a couple collectionLists.
2) AFAIK the headers "jump up" on their own, no need to prepare anything special.
3) productTemplate?
For examples, see https://github.com/iBaa/PlexConnectApp, /TVMLTemplates/Default/Movie_OnDeck.xml (1) or Movie_PrePlay.xml (3).
Or check the gold source: https://developer.apple.com/library/tvos/documentation/LanguagesUtilities/Conceptual/ATV_Template_Guide/StackTemplate.html, plus other Templates.
If you want to use native Swift way it can be achieved in following ways:
You can use table view and have collection view within each cell. I am using same approach to achieve this.
We have focus update delegate from there you can find the focused frame of image view. With the help of focused frame and label frame you can check if they are intersecting or not. Based on that you can move label up and down.
This is native TVML template, in order to achieve in swift you need to create view using tableview and collection view.

Swipe to Delete Section Header in UITableView

I am working on extended data and a UITableView. I am able to use swipe to edit and delete functions. I am wondering if it is possible to swipe and delete only section headers. If yes, how?
I am not sure what you want to achieve.
But if you want to have a swipe delete for a section header, the answer is, you can do it, but it requires some kind of programming. Essentially, you had to add a „section header delete button“ as a subview to the table views content view.
I suggest reading Ray Wenderlichs tutorial „How To Make A Swipeable Table View Cell With Actions – Without Going Nuts With Scroll Views“. This demonstrates how you can add swipe gestures to a table view cell.
However the same techniques (e.g. controlling the position within the scroll view) can be applied to a section views header.

UITableView tableHeaderView user interaction not working

I'm using a table view with a very large header view (not section header) in order to take advantage of the various advantages of table views (performance on long lists, pull to refresh, etc).
The header is ~700 points tall and contains various interactive items - a map, two buttons & a horizontal collection view.
Currently, none of the touch events are being passed through to the controls. I have tried building my own UITableView subclass, overriding the touch events & sending them to the next responder, but this doesn't help.
Strangely, the table still scrolls fine, so I'm not sure why that's happening. I have confirmed that the events are firing through debugging.
As extra details - I'm using iOS 7, Xcode 5, autolayout is on & I'm using a lot of constraints. None of them are listed as conflicting though.
Any idea how I should resolve this?
Thanks
Okay, so I managed to get this working & to be honest it's difficult to tell exactly what it was I did which fixed the issue.
Basically, I had wrapped all my controls inside a main view in order to be able to apply a total height constraint to it. That view did have user interaction enabled, but it seems like it wasn't passing the events through for some reason.
In any case, I removed that wrapping view & everything is now working.
shrug
I actually embedded all my header.xib controls into a View. After that, I was able to click on the buttons.

Giving a grouped UITableView "First Crack" at touches when using a section header view containing a control

I am using a standard grouped style UITableView that returns a custom header view for one of it's sections (using the tableView's delegate method viewForHeaderInSection:). The view that is returned for the section header contains a control. It displays an image and is a control so it can tapped to let the user change the image. My desired UI is similar to the photo for a contact in the Apple Contacts app (a floating imageView-like control in a grouped style table).
The problem I'd like to solve is that touches on the tableView section header go straight to the control. I'd like the table to get a chance to determine if the touch is actually the beginning of a scroll gesture. If not, then the table can pass the event to the section header view for processing.
This is how all the rows in the table behave since I have "delaysContentTouches" for the table on. I suspect the problem is because the section header view is not in the table's view hierarchy. So everything is probably working per spec. just not the way I want.
I want the section header view to behave regarding touches just like rows do (table gets first chance to process).
BTW I am not placing this control in a table row (which would solve the problem) because I want the rounded rect grouped style for all table rows, but not for this one UI element. This control is in the center of my table (header for section 1) which is why I want drags on it to scroll the table.
OK, so apparently this is simulator issue only. On a device my tableView gets the first chance at the event. So I guess I need to listen to the Apple mantra of "always test on an actual device" before posting to StackOverflow. Sorry friends... may my error be helpful to others who, like me, probably spend too much time in the simulator.

Resources