Custom UITableViewCell in Center of Screen / UITableView - ios

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?

Related

How to make a reusable view cells for UITableViewCell and UICollectionViewCell ? I've tried to sublassing UIView for the cell but it's not working

I want to reuse my UITableViewCell to my UICollectionViewCell.
Until now, I always use 2 xibs, 1 for UITableViewCell and 1 for UICollectionViewCell and I think it's kinda waste.
I've tried to subclassing UIView for the cell but it's not working.
A way to do this is by using reusable views. Here is a Github project that can help: NibDesignable
You can also do this without using the project I mentioned, but it does make it easier. You then create a UIView with a View nib and put all your UI into this as well as any code for setting the UI components. Then you create your UITableViewCell and UICollectionViewCell and then just use the view that you created. You can also use prototype cells in a Storyboard for CollectionView or TableView if you prefer.

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

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.

Subviews of UITableViewCell are not visible while reordering

When I reorder my UITableViewCells, the Subviews of the Cell are not visible while dragging...I get always the same result, whether I add the Subviews programmatically in a UITableViewCell Subclass or in Storyboard...
Is there a possibility to see the real UITableViewCell with Subviews while dragging?
Ok I found a solution by my self...
For some reason the mysterious reordering animation from Apple cant capture simple UIViews, but with UIImageViews, UIButtons and UILabels as Subviews of the custom TableViewCell, the animation works like expected...creepy!

iOS custom and scrollable UITableView header and UITableViewCell

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

Resources