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

  • Home
  • SEARCH
  • 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 7710959
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 1, 20262026-06-01T01:15:19+00:00 2026-06-01T01:15:19+00:00

Sometimes I need to make a UITableView that resembles a menu and has rows

  • 0

Sometimes I need to make a UITableView that resembles a menu and has rows that are known before compiling. I typically do this:

typedef enum {
    PEPSI_SODA,
    COKE_SODA,
    DRPEPPER_SODA,
    DIET_SODA,
    COUNT_SODA
} SODAS;

I then return COUNT_SODA for the numberOfRowsInSection and a switch (indexPath.row) { case PEPSI_SODA: cell.textLabel.text = @"Pepsi" break; } for the cellForRowAtIndexPath method. Is this a “proper” use of typedef enum or is there a better way to approach these types of situations?

  • 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-01T01:15:21+00:00Added an answer on June 1, 2026 at 1:15 am

    Create some type of UITableViewController subclass that you can pass a dictionary on the constructor. That way you can always reuse the same class in your projects. Your method is not reusable and produces a lot of effort to extend since you have to change things in various places to add a row.

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

Sidebar

Related Questions

Sometimes you need to upgrade the database with many rows that you have in
I sometimes have the need to make sure some instances are excluded from a
I sometimes need to see what SQL statement SubSonic generates. That works great with:
I make use of session_set_save_handler(). It works fine. However, sometimes I need to alter
When I´m using MATLAB, sometimes I feel the need to make comments on some
Sometimes I need to be sure that some integer is even. As such I
I have an Entity. And sometimes I need this object also contains some value,
Sometimes to make a variable/method/class name descriptive I need to make it longer. But
I am developing a web application and now I need to make this application
Sometimes inside FluentValidation validator I need to make redirect if state is incorrect (for

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.