IOS Swift TableView: Is there a way to move first cell one row down - ios

I'm trying to make a fullscreen tableView but also have some space at the top when the viewcontroller first appears for a searchbar which disappears when you scroll the tableView, right now I'm hacking it by making an invisible cell at top, however is there a way for it to do so that only when you first load the viewcontroller, the first cell is about one row lower but can still scroll up to reach the full height of the viewcontroller, so the top of viewcontroller when you scroll back to top?
This is what I have right now:
The issue I'm having right now is that the invisible cell creates a huge empty space when u scroll down, see below:

As I understand you don't want the search bar to stick at the top of your view, so it must be in one of the tableView Cells, if this is true if you want to have an empty space under the search bar you can have another custom cell which you can customize its height in tableView(_:heightForRowAt) function.

Related

Syncing Two CollectionViews For Navigation

I’m trying to sync two collection views proportionally for navigation. One of the collection views is menu-like and is at the top, and the second is a larger one below. What I would like is for the top collection view to scroll a distance of the width of one cell (the cells are dynamically sized) when the user scrolls the bottom collection view a distance of the main screen’s width. The closest thing I've seen to this effect would be iOS: Custom top segmented control works as expected only when using debugger. What I would like to change is to have the left most cell in the top menu always selected. In addition, when the user scrolls the bottom collection view the width of the screen, a new cell should Replace the left-most cell in the upper menu and be selected. Any help in Swift would be especially appreciated, but ObjC answers are also welcome.

UISearchBar makes UITableViewController scrolling too low (IOS11)

On my UITableViewController the tableview scrolls too low. What I mean by that is that when scrolling to the bottom the last row is actually located way higher than the middle of the screen leaving a big white space on the bottom (lower half) of the screen.
I´m using a tableview with two collection views within some of the cells (if that might be important).
When I "pull to refresh", the tableview scrolls correctly until the view loads again.
EDIT:
So I found out that the issue only occurs when I add my UISearchBar as the header view of my table view instead of adding it to my navigationItem (IOS11).
Does anybody know how to fix this?

How to set Table view cell to occupy entire screen?

I am working on a project to get custom news feeds from Bing news. I created a custom table view cell and populated various UI items in it. But I am having a hard time to make it occupy the entire screen, it starts from extreme left and ends on the right, leaving large gap from the right margin as show in the image. Can anyone help me out, how to correctly fix it with a detailed explanation of how constraints work in Table views and Tableview cells.
Here' what it looks like in the simulator
Remove previous constraints and add constraint to your UITableView like as shown in below image.
So you UITableView will have 0 margin from edges.
Create a UITableViewController. Just drag drop a TableViewCell into it. Add identifier for that cell and use it. By default it will occupy the whole screen.
In your case I guess you might have added constraints to UITableView. Here what you should do is pin your UITableView to Top,Bottom,Right & Left or make UITableView's width equal to SuperView.

An extra view appears in cell when pressing reorder dragger, why?

I have an UITableView with varying height, and when pressing reorder control, in the cell view structure a new view appears. Normally it is not a problem, but sometimes its height is quite big, and it overlaps, with cell below.
Why this view appears?
How can I get rid of it?
Or prevent to overlap other cells?
This view is part of the reorder mechanism and can't be removed. It is used to hide the cell content while you drag a screenshot view above the tableview.
If you set the cell clipsToBounds as YES, it should prevent it's content overlapping other cells.

How to make table view cells scroll "under" instead of over other elements

I'm working with UITableView, but when I "pull" the tableview up to see other cells that are "hiding", it pulls over my logo and a label that I want to be constantly showing. Can I:
either fixate the tableview so it doesn't get pulled out of its intended frame, or
make it scroll under the elements i want to be constantly shown.
Thanks!
In Storyboard, move your tableview above the logo and UILabel.
Or send your tableview to back using
- (void)sendSubviewToBack:(UIView *)view;

Resources