Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8275757
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 8, 20262026-06-08T08:10:36+00:00 2026-06-08T08:10:36+00:00

I create most of my UITableView cells from nibs. On this particular project there

  • 0

I create most of my UITableView cells from nibs. On this particular project there is a lot and they are of a variety of sizes.

Now I specify my cell height in my nib when I’m designing it, and I want this to be the only place I specify this value.

However, tableView:heightForRowAtIndexPath:, is called before my nib is loaded in cellForRowAtIndexPath, so I don’t have the value.

This is ‘mildly’ annoying, as I have to specify my height again in the code.

I could preload a nib beforehand to get this value. Has anyone got any clever patterns they use to manage this, or do you just live with it?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-08T08:10:37+00:00Added an answer on June 8, 2026 at 8:10 am

    Well, I can think of three ways to make this a bit easier:

    1) encode the height into the nib name – myNib.47.xib

    2) Create a mutable dictionary, and at viewDidLoad create entries for the reuseIdentifier as the key and a nsnumber as the object.

    3) Variation on 2. At viewDidLoad, associate UINib objects with the reuseIdentifier using:

    cellNib = [UINib nibWithNibName:@"MyCellNibXYZ" bundle:nil];
    

    in a mutable dictionary. When you need a cell, you call:

    UINib *nib = [mutableDictioanary objectForKey:...];
    MyCell *cell = [[cellNib instantiateWithOwner:nil options:nil] objectAtIndex:0];
    

    You can then instantiate a cell when you need the height, then toss it. The instantiate is a lot faster than going to the file system to read the file on each access.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Most of this code is derived directly from the RubyMotion Locations sample. I defined
I am trying to create an activity feed with the most recent activities from
In most cases if I want to create an optional feature in C, I
Most of the script tags I create, I always include type=text/javascript language=javascript in the
Most of my user stories end up with tasks for create code review, carry
Most things are dynamic in SSRS i.e you can create a custom expression for
Most of the tutorials around explain how to create a java applet: create a
What is the most efficient way to create empty ListBuffer ? val l1 =
My site lets people create database entries (which most rails apps do), and I
I'd like to create a report in Sonar for the most actively edited files.

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.