iOS custom and scrollable UITableView header and UITableViewCell - ios

I want to know how to make a horizontal scrollable UITableView header and UITableViewCell like the app "JP Morgan Fund Watch."
The right part of the UITableView header and UITableViewCell can be scrolled. Any idea how to make it?

You can achieve that effect with using UIScrollView as tableViewHeader and content area of custom UITableViewCell subclass but thinking it is trivial to implement would be naive.
Check the following link for details.
http://theexciter.com/articles/touches-and-uiscrollview-inside-a-uitableview.html

Related

How to make each UITableViewCell snap to top on scrolling of UITableview

I would like to achieve the following functionality. I have an UITableView which consists of UitableViewCells with images of various heights. When i slide up with my finger i need to stick the next UITableViewCell that comes up from the bottom to the top of the UITableView. If i scroll again i need the next UITableViewCell to stop to the top of UITableView and so on. If i slide down the previous UITableViewCell should stick to top and so on. How can i achieve this functionality? Any example or help appreciated.
You can achieve this using paging in UICollectionView

Universal cell for UITableView and UICollectionView

I was wondering if there are some best practices for implementing universal cell which can be used with both of UITableView and UICollectionView...
I tried to put UITableViewCell into CollectionView but Xcode complained about this. I have just one variant left: make UIView which will implement cell's view and then implement UITableViewCell and UICollectionViewCell subclasses which will wrap this custom UIView so it could be placed into Table/Colleciton view. Is that the right way to achieve my goal?
Any thoughts on this?
Your idea can be implemented if the UIView's subviews are similar.You can make a template of UIView,create multiple widgets inside it,and create instance in UITableViewCell and UICollectionViewCell,as UITableViewCell and UICollectionViewCell are usually reused, you need to separate the data model and views,so realize your idea.

How to put UIView inside of UICollectionView?

I want to put my UIView inside of UICollectionView(on top) that on scroll it scrolls with UICollectionView content. It's possible to put it on header part in UITableView, I did it, but in UICollectionView I cannot achieve the same effect. How can I do it?
I have created GitHub repo with sample. If anyone could help me with it.
In UITableView I add UIView inside of UITableView and it stays there, but in UICollectionView it stays behind of UICollectionView. I want that it(UICollectionView sections) will stay under the UIView and on scroll all(UIView & UICollectionView sections) will scroll together.
There is no such thing as collection view footer or header, because the layout can be very different depending on your needs, but, you have a couple of function that can help you for example:
registerClass(_:forSupplementaryViewOfKind:withReuseIdentifier:)
or
registerNib(_:forSupplementaryViewOfKind:withReuseIdentifier:)
depending if you are using a nib file or not.
I'm not sure but you will also need to provide the height of the view in the layout delegate
UICollectionViewDelegateFlowLayout
you can do this by dragging your UIView on to your cellidentifier of UICOllectionView
Like i did see in snapshot:
here View is my UIView which i added to UICollectionView and it scroll with the CollectionView

Custom UITableViewCell in Center of Screen / UITableView

I have a Storyboard with a UITableView
In the UITableView I list custom UITableViewCell's
I thought I could use "autoresizing" in a UITableViewCell like in a view:
But I can't.
This is how it is (not in center).
This is how it should be:
How can I make this right?

How to make a UITableView look like this?

I'm curious of how Youtube `s UITableViewCells are done, here is a screenshot:
Like you can see the cells are like squared and centred, how can I do that?
While you actually can use UICollectionView instead of a UITableView, this layout (YouTube App) can actually be achieved with UITableView as well.
You will need to create a custom UITableViewCell, that has few images and labels. When you create a custom UITableViewCell, you add items to the contentView property. You can then change the constraints or frame of the contentView property to achieve the effect.
Of course, there are more ways to achieve this layout, but I would follow this one:
Create a custom subclass of UITableViewCell.
Give UITableViewCell a clear background.
Give white background to the contentView UIView property of the created subclass.
Add constraints for margin between cells to contentView in UITableViewCell.
Design the layout of the cell in contentView.
It is basically not hard to create a design like this.
Use a UICollectionView instead of a UITableView
Cells are automatically centered, just create a square size.

Resources