Custom view(collection view) Not Scrolling when using VoiceOver - ios

I have custom view:
{CustomView () <UICollectionViewDataSource, UICollectionViewDelegate, UIScrollViewDelegate>}
I have set infinite scrolling in it.
However when I enable voiceOver it doesn't scroll.
I wish to select the entire view and scroll should take me from one cell to the next.
I can however use a 3 finger swipe to scroll if I make the individual cells as accessible elements and not the View itself.(This is not what I want)
Any idea how to go about it ?

Scrolling collection view with cells being accessibility elements can be done by adding collection view to accessibility elements of its parent view like this:
// add to parent view:
Objc:
[self setAccessibilityElements:#[self.collectionView]];
Swift:
self.accessibilityElements = [collectionView]
Now if you keep swiping with one finger to right, voice over goes through all labels of first cell and once its done it automatically scrolls to another cell and goes through its labels etc..

Related

Switch from UIView to ScrollView in Swift

Originally, the number of menus was one, but it was changed to more than one.
So I want to change the UIView (Container View) so that I can scroll horizontally.
Shop Menu View Cell is TableView -> TableViewCell -> TableViewCell (This) on the screen.
I tried several ways to switch to the horizontal scroll view.
I have separated the Container View and made it into a Cell
I also tried adding Scroll View or UICollectionView.
But all the way was not what I wanted.
Perhaps the Shop Menu View Cell is due to having passed the TableView twice.
I could not solve it for four days.
Please give me a hint how to implement.
To create editable forms of data display for static information, static TableViewController is best choice. As it automatically adjust your view when keyboard appear and other many feature, along with scroll. Plus you can directly outlet all the components to your controller class.
Your view will look something like:

Swift; is scrollView with tableView feasible?

I've have been trying for a while now, to implement a specific behavior in my app. On the initial view of my app, there must be a logo(imageView), a label and a textField. It should be possible to scroll down from the initial view, to a tableView. while the user scrolls down, the label in moved up in the window, to form a search field for the tableView. Then the scrollView should lock to the part with the tableView, and it should only be possible to scroll back up, if dragging elsewhere than the tableView.
What is best practice for doing as described?
The image show (only for illustration, i havn't been using story board when trying to implement it) an overview of the problem:
The way I've tried to do this so far, is by embedding the tableView in a scrollView (as seen on image), enabling paging on the scrollView, and than disabling scrolling on the scrollView, when the buttom part has been reached. I've added a gesture reconizer on the part with of the screen with the textField.
These two posts (Scrollview with embedded tableview and Use Pan Recognizer to Control ScrollView) descripe i further detail what i've tried so far.
But the question is more to, is there an alternate solution for making behaviour descriped above?
Maybe interactive animated transitioning between view controllers somehow?
YES there are! Implement a table view with a header view. And remove the scroll view.
self.tableView.tableHeaderView = topView
where topView will be the view wish as the UIImage, the label and textField

Disabling UIScrollView gestures

I've created a custom scrollview class that uses two child views which can be scrolled (with paging enabled) to have either view currently on the screen.
What I would like to do is changing it so that the second view only scrolls in when a specific button is tapped. So the user should not be allowed to scroll in the second view with a drag gesture.
How can I temporarily disabled the drag gesture on the scroll view? (Temporarily because when the second view has been scrolled in, it should be reactivated so the user can drag that view out of the screen).
Thanks for any hints!
self.myscrollview.scrollEnabled = NO;
You can also do it without coding like this:
In the attribute inspector of Scrollview there is scrolling property. Just uncheck the scrolling enabled and it will surely work!See the image.

Scrolling up UICollectionView don't move a UIView above it

I am working in a profile ViewController. This profile has a main image in a UIView subclass and a CollectionView gallery with some images. I would like to be able to scroll up the UICollectionView and move the UIView too, and if I scroll down, I want to watch again the UIView when the collectionView first item is showed again.
I have tried to do this adding the collectionView and the UIView to a ScrollView, but the UIView only scroll up if I touch it.
In this picture you can see my problem
Thank you in advance
You need to make the view at the top a Header View of the collection view.
Essentially it needs to be an actual part of the collection view if you want this action. (That's the easiest way anyway).
So the collection view will take up the whole screen but it will have a header view. Then when you scroll the collection view the header will move out of view and then come back in when you scroll down again.

how to stop UITextView to scroll UITableView

I have a custom table with just three cells. In third cell I have a textView. The three cells cover up enough space on the screen so that just the keyboard space is left. I don't want anything to be movable or scrollable, so I used self.tableView.scrollEnabled = NO;.
This is working fine with earlier version of iOS. However with iOS 5, it shows some weird behavior. When I enter multiple lines of text in textView the whole table scrolls up. Ideally the table should stick there and only textView should scroll.
After trying lots of things I found that the textView is placed so near to the keyboard (as the textView is placed in last cell and just below it is the keyboard) that the iOS tries to move the textView up, for which it scrolls the complete table up. Is there any way to stop this auto scroll of tableView.
I found the same problem mentioned here
Disable UITextView scrolling the containing view?
however it is also not answered yet. And the workaround mentioned over there won't work for me as my containing view itself is scrollable (UITableView)
for me, i work around with scroll in table view like this
-(void)scrollViewDidScroll:(UIScrollView *)scrollView
{
if(self.tableView.contentOffset.y != 0)
{
self.tableView.contentOffset = CGPointMake(0, 0);
}
}
One solution is to add a completely new subview on the fly. Add a UITextView to self.view and give it a frame that corresponds to the same position on the screen. The table view should not scroll now.
In case this does not work because self.view is the table view, change your controller into a class UIViewController and implement the delegate and datasource methods yourself (i.e. you have to mention them in the #interface declaration). The table view should then be a subview of self.view and you have to hook it up via IB.
Before you dismiss the keyboard, copy the content to your original text view.

Resources