cellForRowAtIndexPath is called but without stacktrace - ios

Using Swift 3, the UITableView's func tableView(_ tableView: UITableView, cellForRowAt indexPath: #autoclosure #escaping IndexPath) -> UITableViewCell is being called. I want to track who's calling this function. As far as I know, this will only be called if there's a need for a cell to display. However, in stacktrace override internal func tableView(_ tableView: UITableView, numberOfRowsInSection section: #autoclosure #escaping Int) -> Int is not called and there is no stacktrace. Could someone advice to where to start digging up? Thanks!
See attached screenshot

By default, you only see the stack trace that contains debug symbols. So you won't see many framework internals here.
To see everything, there is a small button at the bottom of the stack trace window, third position from the right, that will enable also methods without debug symbols:
(In fact, it depends on your Xcode version; in older versions there is some sort of slider which will display more or less details in the stack trace).

As #AndreasOetjen mentioned, this is a normal behavior because the method get's called from a UIKit Framework class. The call-stack in this Framework is hidden by default and can be opt-io by the mentioned buttons.

Related

How to get row order info in multivalued section?

I am using MultivaluedSection with an option .Reorder to reorder my cells, for which I need to know the exact order.
I tried with section.allRows, form.allRows, form.values() but seems like they all do not keep the information about order, even though they return an Array.
Note: I was trying to catch this data in overridden:
func tableView(_ tableView: UITableView, moveRowAt sourceIndexPath: IndexPath, to destinationIndexPath: IndexPath)
Actually I realized that after overriding that method I was "killing" that update, of course.
Still, I don't know how to "catch" when a change happens.

I don't see my buttons when running the simulator - Xcode10

I was trying to follow a tutorial online but the version that was being used was older than the most recent Xcode10.
I have added a navigation controller and added buttons to the controller...
navigation controller with buttons
But when I run the simulator, I do not see the 2 buttons that I created....simulator without buttons
Any ideas why this would be the case? All help is appreciated :)
To calculate the height, UITableViewCell rely on the content of the cell and to be able to do that you should add constraints to the buttons you have already added.
or you should implement the delegate method
func tableView(_ tableView: UITableView,
heightForRowAt indexPath: IndexPath) -> CGFloat

UITableViewCell content is sometimes overlapped by delete button (on swipe)

I've implemented swipe to delete in UITableView a lot of times before, but never faced this problem before. In my last app delete button sometimes (not always) doesn't shift cell's content, but just overlaps it. See attached screenshot.
I use standard iOS functionality for this:
func tableView(_ tableView: UITableView, canEditRowAt indexPath: IndexPath) -> Bool {
return true
}
Probably, somebody already faced with this issue and know how to fix it?

Can't Swipe Due to editingStyleForRowAt

There seems to be an error that's impossible to avoid, but I'm hoping someone can do the impossible.
In a UITableView editMode there's a lefthand delete indicator (red circle with a white line):
I just want the drag / drop grip on the right, so I get rid of the indicator by calling:
func tableView(_ tableView: UITableView, editingStyleForRowAt indexPath: IndexPath) -> UITableViewCellEditingStyle {
return .none
}
However, it also seems pretty clear that if you want the ability to swipe for actions...
You CANNOT call the above "editingStyleForRowAt" method. So it seems like I'm forced to choose only one of the above features... oddly you can only return ".none", ".insert", or ".delete".
Anyone know of a solution?
In your case you should try with custom cell.
Please check below link.
I just assume, it is work for you, I am not sure.
https://www.cocoacontrols.com/controls/eecellswipegesturerecognizer

Naming Convention in tableView functions

So I am just getting into the whole tableView thing but I came across a curious observations and have a question:
Why is it that overriding this function in my UITableViewController class
override func numberOfSections(in tableView: UITableView) -> Int
has a descriptive name but the number of rows in the section is determined this way
func tableView(_ tableView: UITableView, numberOfRowsInSection section: Int) -> Int
I find the former much more logical and wonder why it is not used consequently for other tableView parameters.
Why are different versions of the function tableView called for most tableView properties, instead of different functions with descriptive names?
I am sure there is a very good reason and would be thankful if someone wiser than me could shed some light on the issue.
So to put it frankly: Compatibility with Objective-C seems to be the reason for this inconsistency.

Resources