UITableView not scrolling issue - swift

When I first load data into my tableview it doesn't scroll even when UserInteractionEnabled is true, but when I click on top of the tableview the cell scrolling gets enabled.
Does anyone know why this might be the case?

UITableView could be tricky to answer. Let's check if you have few basics done right:
In Attribute inspector, make sure TableView has following
1- Scrolling Enabled is checked
2- User Interaction enabled is checked
Also in ContentView height is less than TableView in design
Let's start from these mentioned checks first

Related

UISearchBar stays visible after scrolling

I created a TableView and added a UISearchBar from the storyboard.
The UISearchBarContoller didn't work for me so I decided to use the IBOutlet method.
The problem is when I'm scrolling down, the search bar goes up and gets behind the segment controller.
I couldn't find any questions about this or any fixes on the internet related to the IBOutlet and not the UISearchContoller.
Is there any way to make it collapse?
I know I can take it out of the TableView, but I want it to collapse into itself when scrolling.
I don't know how your storyboard or code is set up so I can only give guidelines.
A few guesses:
It seems that you've set up the searchBar as a cell of the tableview since it scrolls with the content. Try setting it out either outside (above) the tableView or as header (see answer 2)
If you've set it up as the tableHeaderView you need to be wary of the fact that UITableViewStylePlain will keep it at the top, but UITableViewStyleGrouped will not.

Make tableView readonly but scrollable

How can i easily make a tableview readonly but scrollable?
i tried to set tableView.isUserInteractionEnabled = false.
However, it disabled the scrolling action either.
I'm not sure I understand your question but a table view has no default interaction on it unless you write it.
You create the table view, configure the data source and the cells and thats it.
You can add behavior to it so when you tap on a cell allows you to navigate to detail, delete it, etc.
If you don't want the cells to react visually when the user taps them, just set the selectionStyle of the UITableViewCells to UITableViewCellSelectionStyleNone

uitableview inside a uiscrollview (scrolling issue)

I have got a uitableview inside of a uiscrollview.
So the uitableview is smaller than the uiscrollview. And when I start to scroll down on the uitableview and it reaches the bottom, I am able to scroll in the uiscrollview.
And it works fairly. But not perfectly.
I would like to make the ux perfect so the scrollview would be kind of an extension (or another section of the uitableview). I don't want to add any section or footerview at the bottom of the tableview.
I was wondering on doing this by implementing something like this:
//
if tableview didscroll to bottom
then scrollview scrolltorect xxx
//
but it would only work if the uitableview was scrolling down.
I am not sure if this would replicate the correct ux behaviour.
Could you guys give me your advice on how to do this?
Thank you and best regards.
I found this very hard and difficult to execute so I changed my UI in order to put the bottom of the interface inside the tableview footer's view. This way the experience of scrolling my app got much smoother.

iPhone Dev - Implementing checkmarks in a tableview that is in edit mode

I know how to use checkmarks in a tableview when it is not in edit mode. But once in edit mode, it seems that it won't allow me to add checkmarks. Any ideas how to get around this?
Detail accessories are pushed offscreen during editing. This is native behavior and unless you have a peculiar use case it's perfectly fine. If you are editing to sort by checked vs. unchecked, do that automatically. If you really need to, poke around in the methods of your table's delegate. Protocol reference.
Perhaps you can use the built in UIImageView that is on the cell so that when you are editing, if your table allows the editing of multiple rows, when the user taps the cell, the UIImageView is filled with the image of a check mark, but when the table is not in edit mode then the UIImageView is empty.
You can use the allowsMultipleSelectionDuringEditing property of UITableView to decide whether cells are selectable in editing mode.
Then calling indexPathsForSelectedRows will give you the indexPath of the rows the user has selected, and then perhaps you can have some logic to edit the cell's UIImageView property.
A bit hackey, but I hope this helps!

UITableView doesn't scroll when number of items is less than scrollable limit

I've a UITableView and I populate data from a service. When the number of rows is higher than what could be displayed on the screen, I'm able to scroll the table. But when it's less (say 1 or 2), I'm unable to scroll (in the sense, the bouce effect doesn't work making the UI appear odd).
I think this should be fixed by some IB checkbox, but not sure how to do it. Anyone faced this issue before?
The solution that worked for me was to set bounces to YES programmatically in viewDidLoad.
I also have bounces set to YES using the checkbox in IB. It does appear to be taking the IB value because bouncing will work after I've pushed another view controller onto the navigation controller stack and then popped it back off. However, bouncing won't work when the table view first appears unless I set bounces to YES in viewDidLoad.
Click on the table view and look at the Attributes Inspector. There's a checkbox for Bounce Scroll. (I just tested this in a project that had a 2-line table; disabling it prevented scrolling, enabling it allows the short table to bounce)
I think the programatic equivalent is the bounces property.
Do you have this table view as a cell inside another table view?