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 6374749
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 25, 20262026-05-25T01:31:37+00:00 2026-05-25T01:31:37+00:00

I have a list of name and values I need to display. It’s difficult

  • 0

I have a list of name and values I need to display. It’s difficult to maintain lots of labels and associated content textfields in IB so I’m thinking of using UITableView. Is there a way to fix the labels for cells, then just either bind to an NSDictionary and display the key/value names or fix the cells and labels in a UITableView?

  • 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-05-25T01:31:37+00:00Added an answer on May 25, 2026 at 1:31 am

    You can’t bind to the table view as you might do when writing OS/X apps, but the two methods below, in your UITableView’s datasource should do the trick:

    @property (strong, nonatomic) NSDictionary * dict;
    @property (strong, nonatomic) NSArray * sortedKeys;
    
    - (void) setDict: (NSDictionary *) dict 
    {
        _dict = dict;
        self.sortedKeys = [[dict allKeys] sortedArrayUsingSelector: @selector(caseInsensitiveCompare:)];
    
        [self.tableView reloadData];
    }
    
    
    - (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section
    {
        return [self.sortedKeys count];
    }
    
    - (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath
    {
        UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:@"Cell" forIndexPath: indexPath];
    
        NSString * key = self.sortedKeys[indexPath.row];
        NSString * value = dict[key];
    
        cell.textLabel.text = key;
        cell.detailTextLabel.text = value;
    
        return cell;
    }
    

    or in Swift

    var sortedKeys: Array<String> = []
    var dict:Dictionary<String, String> = [:] {
    didSet {
        sortedKeys = sort(Array(dict.keys)) {$0.lowercaseString < $1.lowercaseString}
        tableView.reloadData()
    }
    }
    
    override func tableView(tableView: UITableView!, numberOfRowsInSection section: Int) -> Int {
        return sortedKeys.count
    }
    
    override func tableView(tableView: UITableView!, cellForRowAtIndexPath indexPath: NSIndexPath!) -> UITableViewCell!  {
    
        let cell = tableView.dequeueReusableCellWithIdentifier("Cell") as UITableViewCell
    
        let key = sortedKeys[indexPath.row] as String
        let value = dict[key] as String
    
        cell.textLabel.text = key
        cell.detailTextLabel.text = value
    
        return cell
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a list of items, which has two values, a name and an
Instead of just displaying list values using <s:property/> , i need to display it
I have a list like this: <select name=select_list_name id=list_id> <option value=>Select Option</option> <option value=value1>Option
I have list in python which has following entries name-1 name-2 name-3 name-4 name-1
I have a list of imperfections in my code: the list contains the name
Let's imagine that I have list of files at host1 find /path/to -name *.jpg
I have a list of dictionaries: people = [{name: Roger, city: NY, age: 20,
I have a view with a name list. I want to jumble the list
I have chat list view in which sender name should be left aligned and
I have a list of this class: public class Data { public string name

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.