Is calling cellForRowAtIndexPath: ever practical?
Personally I don't think there are ever good cases to directly call tableView:cellForRowAtIndexPath:
directly on the data source.
For case #1 it is simply bad coding. The cell should never contain the data. The data source should have the data so get the data from the actual data source, not the cell.
For case #2 you would only ever need to update a visible cell. And for this you can use the UITableView cellForRowAtIndexPath:
method. No need to call the data source for the cell.
I try never to say "never" but it should be an extremely rare case where you have a real need to get the cell by calling the data source method.
cellForRowAtIndexPath not called; sections returns 1 and rows returns 4
In fillArrays, you create another view controller - but you never do anything with it or its view, you would never see that view. You would never call viewDidAppear manually either, that happens automatically when a view controllers view is displayed (ONLY in the context of a navigation controller though).
Normally the flow is, you create a view controller and either add that view as a subview of a current view, or push it as a new window via a navigation controller. I'm pretty sure your whole issue is that they table is never added to a view anyone actually sees, so the table calls the other methods but never calls cellForRow because its layoutSubviews code is simply not being called.
iOS UITableViewCell Have To Hold A Long Press To Select Item
I found my answer here - I had a UITapGestureRecognizer
on the UITableView
's parent view, which was capturing the tap.
How to get a cell without calling cellForRowAtIndexPath in objective C iOS?
As of my understanding, you are trying to get the cell object by calling UITableView datasource method. But when you try to do like that then it will be infinite loop call and you will never get the cell object. So in order to get cell object from UITableView, do the following steps.
Declare your UITableView as global to the your ViewController, something like
UITableView *_tableView;
or@IBOutlet weak UITableView *_tableView;
Then try to call the
//specify the item indexpath
NSIndexPath *_indexPath = [NSIndexPath indexPathForItem:3 inSection:1];
//now try to access cell object by passing cell indexPath
UITableViewCell *_cell = [_tableView cellForRowAtIndexPath:_indexPath];
Related Topics
How to Know Which Line of Code Has Caused My iOS App to Crash in Xcode 9
Go Back to View Controller from Skscene
Can't Use @Observedobject on Real iPhone
Populating Input Text Field in Wkwebview
My App Is Getting Crashed on UIdocumentpickerviewcontroller
Customize Google Maps Blue Dot for Current Location
Googlemap API Gives Wrong Coordinates for Direction Between Two Points
iOS 11 CPU Throttling and Idle Timer
Terminating App Due to Uncaught Exception 'Nsinvalidargumentexception' - iOS Google Sign In
How to Get a Low Res Image, or Thumbnail from the Alassetrepresentation in Swift
How to Queue Multiple Accessibility Notifications for Voiceover
How to Mock Network Requests in Xcode UI Tests While The Tests Are Running
Update Responsejson to Responsedecodable in Swift
How to Bind Multiple Observers to One Controlproperty
Xcode 8/Swift 3 and Installing Apps on iPhone 4 Running iOS 7
Core Data Nstimeinterval Using an Accessor Directly Is Buggy