Infinity backgroundView in tableView - ios

I have UITableView with background image and then I scroll it I have parallax effect like background imageView scrolls too. Problem is that then my image finished I have tableView background. Is it possible to make infinity imageView? Like then I go through image then starts this one image from beginning.

In next few days I will add lib thay solved it and creates parallax effect under tableView
https://github.com/bizibizi/TableView-Parallax-Background

Can you show me how are you placing that image behind the TableView? I guess the hierarchy in the storyboard should be
UIView -> UIImageView -> UITableView
The size of the UIImageView and the UITableView should be the same. So when you scroll up and down the UITableViewyou could see the image in the background.
But please explain your scenario abit more so that I could suggest you something appropriate.

What Hanny means is that you need to have the tableView on top of imageView ordered in the stack of the parent view's subviews. What you can also do is stack two tableviews on top of each other, and add a touch event that moves both table view's scroll views. The image table view would contain cells that are the size of the whole view frame.

Related

Scroll Tableview Cell with outer Scrollview instead of It's own scroll ?

I have an Imageview covering half of the screen height and a tableview below it. Both are wrapped inside a UIScrollView. I want to scroll the whole view. Means inner scroll of tableview won't work and when I scroll, outer scroll will scroll image view up and then showing cells of tableview. At the end, Imageview will hide behind scroll and tableview content will take entire space. Can anybody tell me how to achieve this. ?
Thanks
I don't think you need the outer scroll view(UIScrollView). Why don't you add only the inner table view and image view to where your outer scrollview is added. The image view can be added either above or below the table view. Let say your image view is below the table view then your image view will be covered by table view. In order to make it fully visible, set the talbview's content inset top to imageview's height and its background to clear color. then you can see both image and table view contents without one covering the other. The last thing you need to do is you have to handle the image view's y position when you scroll the table view so it looks like they are in the same scroll view. Use the scroll view delegate that is already available to you and play with scroll view's content offset and image view's y position.
I answered some similar question here with some sample code. Hand off parent container's pan gesture to nested UICollectionView
It does with collection view but the main idea is same.

Swift image slider/carousel UIPageViewController vs Scroll View

I found these examples of doing a images slider/carusel. One using a UIPageViewController and one using a scrollview
In my app I need to embedd a image slider inside a contentview for a VC, then also add click to enlarge to view the image in fullscreen as well. So what are the pros/cons for using a UIPageViewController or a scrollview?
Looking at the two examples they look like they behave the same beside the UIPageViewController showing dots/indicators
I wouldn't recommend using a UIScrollView, (too much work/potential for bugs resetting the scrollView's contentOffset for sliding through the gallery smoothly).
When I've implemented a sliding image gallery before I used a UICollectionView. The collectionViewCell's bounds match the parent collectionView's, the cell contains an imageView pinned to the edges of the cell and the collectionView's scrollDirection is set to horizontal.
You can add a UIPageControl on top of the UICollectionView if you want, it's not necessarily an essential feature. As an alternative to using a UIPageControl I've added a UILabel to float above the screen coordinates of the UICollectionView and update its value based on the number of items and the currently displayed cell in the collectionView. E.g. 1/4 -> 2/4 etc.

Custom tableview scroll iOS

I need to show three/ four UI buttons and levels, two image views in a custom cell but there is a condition on the basis of that I need to hide an imageView and when it will be hidden, I need to decrease tableview size and buttons which are below of that image view that will move upward.
For that I am giving required conditions in
heightForRowAtIndexPath
and returning cells height accordingly and in tableview
CellForRowAtIndexPath
method I am hiding imageView and setting buttons positions which are below of that imageView.
The problem is that:
1) TableView is not scrolling smoothly
2) Initially at the time of scrolling down everything is working but when I
move upward then image is resizing and changing its shape. To solve that I have used AutoLayout but still it is not working.
I need your expert advice.
Thanks in advance.

Interface design in Foodspotting

On the app Foodspotting, you have a scrolling view that has two elements:
1) An image.
2) Some information below it.
Like this:
When you start scrolling down, the behaviour is not natural of a UITableView, or at least I am not understanding it. The below view start's going up and overlapping the UIImageView above it:
And finally:
What I have tried:
1) Using the first four cells without content and invisible and finally an UIImageView as subView of the UITableView
2) The same as above but using the UIImageView as subView of the root view and below the UITableView.
3) Mixing the UITableView and a UIScrollView with an UIImageView inside the UIScrollView.
So my question, how was this achieved?
Edit 1.0
If someone want to try, you can check the project here.
Looks to me like a UIViewController with a UIImageView on the bottom.
Then a UITableView on top of that (grouped table view) with a transparent background.
The header height is then set to almost the height of the entire view. With a button (or whatever that is) near the bottom of the header.
You could access the scrollView:didScroll to adjust the position of the UIImageView in the background (it looks like the center point of the image is always half way down the visible part of the header.
bgImageView.center = CGPointMake(0, (bgImageView.frame.size.height - scrollView.offset.y) * 0.5);
or something like that.
Obviously the image view would not move any further down than the top so you'd have to catch that somehow.
Looks like an image view is the background view of the table (so it won't scroll), a large transparent view as the table header (possibly with that first button in it, or that could be a transparent cell) then opaque cells for the remaining content.
And that risotto is far too wet. 0 stars, more like rice soup.

TableView doesn't not scrolling and cells is not enabled

I've created UIImageView with tableView and put this view on another view. But my table isn't enabled. I can't press on the cell or scroll my table.
Try creating a UIView with your UIImageView and UITableView as subviews.
I don't think it's a good idea to have your table as a subview of an imageview.
I suppose you did this to have a background image for the table, but a transparent table with an image view behind can easily achieve this effect.
Do you have a UITableView as a subview of a UIImageView?
If that is the case then the problem is probably that userInteraction is disabled on your UIImageView (it is set to NO as default for UIImageViews).
You can try to set it to YES and see if you can interact with your UITableView. However I would not recommend this view structure as I don't believe it is intended to put UITableViews as subviews to UIImageViews

Resources