How to use static cells in UITableView without using Storyboards?

Static table view cells are only available when using storyboards. However, if you aren’t using storyboards for your entire UI you can still use them for individual screens instead of a collection of screens.

To do this you can create a UIStoryboard file with a single view controller on it that has it’s File’s Owner set to your custom view controller subclass. Set the VC’s identifier to some value. When you want to display this, get the storyboard and then instantiate your view controller subclass by creating the VC from your storyboard.

UIStoryboard *tableViewStoryboard = [UIStoryboard storyboardWithName:@"your storyboard" bundle:nil];
CustomViewController = [tableViewStoryboard instantiateViewControllerWithIdentifier:@"custom identifier"];

You can present this VC as usual in your app.

This is a great way to start using storyboards without having to convert your entire app to use them.

Leave a Comment