Custom Table View Cells! (XIB Files : Swift 3 in Xcode 8)

Jared Davidson · 159K views · 2016 · 19:06

Open on YouTube

Software (other)Web developmenttutorialdated

Why Stack Overflow recommends it

Stack Overflow users link it as a beginner-friendly walkthrough of custom table view cells from XIB files, both in answers and in questions that follow it.

Recommended by 3 people across 3 different months, 2016 to 2019.

What it is

A 19-minute Swift 3 and Xcode 8 tutorial by Jared Davidson that shows how to build custom UITableViewCell subclasses using XIB (nib) files. It walks through creating the cell, registering the nib, and loading it into a table view.

What people said

Recommends bibscy · 2017-03 · Stack Overflow · on “How to get textFields from static cells in UITableViewController? Swift”

@Magnas View Controller is EleventhViewController . I have created the view hierarchy after this tutorial [this video]

Recommends E. Huckabee · 2018-02 · Stack Overflow · on “Array of Int and String: Update only Int value?”

It is, actually. If you want to know more about tableView cells and how to implement them, check out this [this video] tutorial on YouTube. That tutorial is one of the simplest tutorials I know of, and the guy explains everything.

Recommends Mohammed Ali Khaled · 2018-07 · Stack Overflow · on “UITableView load more when scrolling to bottom like Facebook application”

The best way to solve this problem is to add cell at the bottom of your table, and this cell will hold indicator. In swift you need to add this: Create new cell of type cellLoading this will hold the indicator. Look at the code below Look at the num of rows and add 1 to it (This is for loading cell). you need to check in the rawAtIndex if idexPath.row == yourArray.count then return Loading cell. look at code below: import UIKit class LoadingCell: UITableViewCell { @IBOutlet weak var indicator: UIActivityIndicatorView! } For table view : numOfRows: func tableView(_ tableView: UITableView, numberOfRowsInSection section: Int) -> Int { return yourArray.count + 1 } cellForRawAt indexPath: func ta

Cites mcd · 2016-12 · Stack Overflow · on “Swift: Multiple Custom TableViewCells from XIB files”

I am following this tutorial from Jared Davidson [this video] to implement multiple CustomTableViewCells with XIB files in my app. I have these files in my Xcode project: [LINK] . I have a TextElement: [LINK] and I have an ImageElement: [LINK] I want to test this with offline data to implement Firebase after this is working. This is my Home.swift data struct: import Foundation import FirebaseDatabase struct Home { var key:String! let itemRef:FIRDatabaseReference? var userUID:String! var user:String! // Home Element Cell Content var elementSortNumber:Int! var elementCellType:String! var referenceElementID:String! var databaseVersion:String! init (key:String = "", uid:String, user:String, elementSo

Cites Chris · 2017-09 · Stack Overflow · on “Dynamically resize TableViewCell with and with out images”

Using swift3, I want to allow users to create posts of either pictures or simple text posts. I have everything working fine except for when I create a post of just text, the UIImageView in the cell fills out space in the TableViewCell. Ideally, if the user creates a post of just text, the TableViewCell will only include everything down to the caption label but not the UIImageView (see image). How can I go about this. Research: [this video] , [LINK] , [LINK] Current Code func configureCell(post: Post){ self.post = post likesRef = FriendSystem.system.CURRENT_USER_REF.child("likes").child(post.postID) userRef = FriendSystem.system.USER_REF.child(post.userID).child("profile") self.captionText.text =

Cites Rosalie W · 2019-04 · Stack Overflow · on “How to press on a tableview cell to present a view controller with the text in navigation controller”

You can use the didSelectRowAt to notice what cell was clicked and store what the text in the cell was (homeworkArray is the list of cells from a struct. Homeworkidentifier is a value in the struct). var homeworkIdentifierFromTableViewCell = "" func tableView(_ tableView: UITableView, didSelectRowAt indexPath: IndexPath) { homeworkIdentifierFromTableViewCell = homeworkArray[indexPath.row].homeworkIdentifier self.performSegue(withIdentifier: "homeworktoExpandHomework", sender: self) homeworkTableView.deselectRow(at: indexPath, animated: true) } Then, you could use a prepare for a segue function to pass the text of the table view cell to the next view controller. You do this by creating a vari

Cites TJ Olsen · 2019-07 · Stack Overflow · on “How to add spacing between UITableViewCell”

Using the headers as spacing would work fine I guess if you don't want to use any headers. Otherwise, probably not the best idea. What I'm thinking is create a custom cell view. Examples: Using Nib [this video] In code [LINK] In the custom cell, make a background view with constraints so that it doesn't fill the entire cell, give it some padding. Then, make the tableview background invisible and remove the separators: // Make the background invisible tableView.backgroundView = UIView() tableView.backgroundColor = .clear // Remove the separators tableview.separatorStyle = .none