Reputation: 437
If I have a tableview that is populated with elements from an array but I want the first cell to be some specific element not within the array if some variable equals whatever, and then have the array populate the rest of the cells after it, how do i go about doing that?
Upvotes: 0
Views: 36
Reputation: 1232
Check func tableView(_ tableView: UITableView, cellForRowAt indexPath: IndexPath) -> UITableViewCell
.
https://developer.apple.com/documentation/uikit/uitableviewdatasource/1614861-tableview
Using an if statement, return a different cell when row == 0
then return cells reflecting the array afterward.
Upvotes: 1