I've seen people with similar problems here, but couldn't find any working solution. I have a UICollectionView, with fullscreen cells. I scroll the content horizontally (paging enabled). Each cell has a UIScrollView as a subview, which covers the entire cell. My problem is that when I use zoom-in functionality of a UIScrollView, I can't scroll from one cell to another unless I zoom-out to 1.0 scale or reach a border of a UIScrollView content. My idea was to use two-fingers pan gesture to scroll the collection view, so I could use one finger to scroll cell's internal UIScrollView. It doesn't work and I simply have no idea why. I can provide more details, but for now I don't know what might be important.
Related
I need a parallax scrolling effect. Something like Make My Trip app home page screen.
Any suggestion please. Demos or examples.
You can create two collectionviews with different item sizes and minimumInteritemSpacing.
Keep user interaction enabled for the collectionview at front but disable it for the other collection view.
On horizontal scroll of front collectionview, scroll the rear collectionview as well.
You can use scrollViewDidScroll method for this and scroll the rear collectionview accordingly.
Context:
I have a UIPageViewController with 4 UIViewControllers, a sort of SnapChat style.
In 3 of those 4 UIViewControllers, I have a UITableView or a UICollectionView, two controls that inherit of UIScrollView.
The problem:
When I scroll (vertically) a UITableView or a UICollectionView, I cannot scroll horizontally (swipe) to the next page until the scroll is finished. Instead, when I try to swipe, the scrolling stops and then I have to do another swipe to actually change the page of the UIPageViewController.
What I expect:
The user has to be able to change the page when swiping, even if the UITableView or UICollectionView is still scrolling, as SnapChat currently does.
Any tips to achieve this?
Thanks!
I believe your issue is that your scroll view has an active gesture recognizer firing when you are scrolling, so the other gesture isn't being identified. I found this as a solution: How to have a UIScrollView scroll and have a gesture recognizer?
If you look at the Featured tab of the Apple App Store app on an iPhone 6, there is a unique UI layout that I can't figure out how to replicate.
At the very top there is a navigationBar. Below this there is a UIScrollView that animates through a number of featured items. Below this is what appears to be a UITableView with a number of custom programmed cells.
My first guess was that the UIScrollView at the top was added to a custom cell at the top of a UITableView. If you swipe up the UIScrollView moves with the objects below like it is a cell. You can see that the vertical scroll indicator starts at the top of the UIScrollView.
The part that is unique is that if you swipe down, the objects below the UIScrollView move down like a UITableView and the UIScrollView stays in place. This means that the UIScrollView is not a custom cell at the top of a UITableView.
I tried making this work a number of different ways but I can replicate this. Does anyone know how this can be done?
You can use a tableview header,the header is a scrollview
If you scroll tableview up,just use tableview default behavior,the header will scroll up.
If you scroll down,use UIScrollViewDelegate to calculate the tableview header new frame,and adjust it.So it remain at top
Not sure if I got you correctly, you may use UICollectionView as vertical scroll. Then, you create a custom UICollectionViewCell, each with horizontal scroll.
I haven't tried it though but done something similar to this. Hope you find a way!
I am following this excellent small tutorial about drawing on screen in the layer of a UIView (subclass).
http://spritebandits.wordpress.com/
It just works.
There is just one thing. I placed this view as subview of a UITableViewCell which, naturally, is displayed as part of a UITableView.
I guess I would have the same issue when I would place it within an UIScrollView. (UITableView inherits from UIScrollView anyway)
Touches are triggered by my painting view as long as their related movement is horizontal. As soon as I move the finger kinda vertical, even partly, then the UITableView takes over and scrolls the table.
Is there any proper way of stopping the Table to taike control of the touches while the touch is actually within my view?
If it is of importance: I am using storyboard. The cell is a prototype cell with its own subclass of UITableViewCell.
I've implemented this using the same class "Canvas" you're saying and also inside a UITableViewCell. But I didn't use the entire cell for drawing, only a UIView inside of the UITableView as a subview.
I reached the whole user experience by activating and deactivating the UITableView scrolling when that UIView (subview of the cell where I allow the drawing) fires touchesBegan or touchesEnded. So when they touch/move inside the UIView, they're drawing. When it's outside, they're scrolling. So they can't scroll on the UIView because they will be drawing.
The problem in your case is that since the whole cell is the view for drawing, the user cannot scroll in this concrete cell because it's the drawing one.
Hope this will help.
I dont have an answer for that. But there is essentially a work around.
You could get the user in to a drawing mode, where the scrolling for a UItableviewcell is disabled and then
once the user is done with drawing, you could enable scrolling again.
Inclusion of a button anywhere on the screen would help you switch modes.
I want to implement a paging UIScrollView that will scroll in both directions (vertically, and horizontally). The default behaviour of UIScrollView is to be one, or the other. Not both.
Is it possible to implement a UIScrollView that would allow paging in both directions? For example, the user would be able to scroll left and up for the previous page with paging in UIScrollView, right and down for the next page.
I can use UIScrollView to implement scrolling horizontally with paging but I can't see how UIScrollView can be scrolled in both directions while paging. How could I implement this behaviour? UIScrollView ? or CAScrollLayer? or anything else?
Any suggestion are appreciated.
You seem to be talking about two different things here: scrolling and paging.
Scrolling is just flicking around to move the screen's viewport over a view that is larger than the screen itself. Normally you set this up by giving a UIScrollView a subview that is larger than it, and setting the UIScrollView's contentSize to the size of the larger thing.
There's nothing magic about it. If contentSize is taller than the UIScrollView's size, the scroll view will scroll vertically. If contentSize is wider, it will scroll horizontally. If contentSize is both taller and wider, then you'll scroll both vertically and horizontally.
Paging is a different matter. To know how to make it so "you can scroll left and up for the previous page", we'll need to know what a page looks like in your program, how it's represented, etc. From the small description you're giving, I think UIScrollView probably isn't the way to go. Instead, look into UIPanGestureRecognizer and some sort of animated transition between views?
But if that doesn't help, you'll need to give us some more details to work with.