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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 12, 20262026-06-12T01:55:18+00:00 2026-06-12T01:55:18+00:00

I want UITableView to show cells in section separated (have distance, blank space, between

  • 0

I want UITableView to show cells in section separated (have distance, blank space, between them).

So I’ve come up with this:

InventoryViewController.m

- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section
{
    return 1;
}

- (NSInteger)numberOfSectionsInTableView:(UITableView *)tableView
{
    return [[[InventoryStore sharedInventory] allInventories] count];
}

- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath
{
    Inventory *p = [[[InventoryStore sharedInventory] allInventories]
                  objectAtIndex:[indexPath section]];

    StepperCell *cell = [tableView
                         dequeueReusableCellWithIdentifier:@"StepperCell"];

    [cell setController:self];
    [cell setTableView:tableView];

    [[cell nameLabel] setText:[p inventoryName]];
    [[cell valueLabel] setText:
     [NSString stringWithFormat:@"$%d", [p value]]];
    [[cell quantityLabel] setText:
     [NSString stringWithFormat:@"%d", [p quantity]]];
    cell.stepper.value = [p quantity];

    return cell;
}

and of course in AppDelegate.m

InventoryViewController *inventoryViewController = [[InventoryViewController alloc] initWithStyle:UITableViewStyleGrouped];

My question is, is there a better or simpler way to separate cells, but in the same section?
I want to have one section, and draw data from one array, but these cells should have distance between each other.

  • 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-12T01:55:20+00:00Added an answer on June 12, 2026 at 1:55 am

    If the table has blank separators (i.e. separatorStyle set to UITableViewCellSeparatorStyleNone) then you can inject blank cells between each cell.

    e.g.

    - (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath {
     if (indexPath.row % 2) {
     /* Your cell rendering code goes here */
     }
     else {
      UITableViewCell * blankCell = ....;
     }
    }
    
    - (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section
    {
        return (numberOfInventoryItems * 2) - 1;
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a UITableView and I want to determine what cells will be visible
I have a UITableView that I want to edit inside of a UITableViewController. This
I have a UITABLEVIEW where I want to show the delete function for only
I want to show animation when add cells to UITableView. Here's is what I
I have a plain ol UITableView, and I want its cells to have the
I want to show my custom objects (images, formulas) in UITableView row name. Is
I want to display a UITableView with Multiple Columns. The first column will have
I have a UINavigationController/UITableView and I want to present a UIView over top of
I have a UITableView which I want to populate with details from an array
i have a UITableView where i want one cell(database row) needs to be default,

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.