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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 27, 20262026-05-27T01:26:36+00:00 2026-05-27T01:26:36+00:00

In my app I have a table view with 12 types of custom cells.

  • 0

In my app I have a table view with 12 types of custom cells.
I designed each within the storyboard.
In general everything works fine – thanks to your tutorials 🙂
My problem is, that I have individual styles an additional data in each cell – therefore I don’t want them to be reused.
How can I generate a individual custom cell from storyboard to provide it in the –

tableView:cellForRowAtIndexPath:indexPath?

Any suggestions?
Thanks
Dominic

Added:

    newCell = [tableView dequeueReusableCellWithIdentifier:cellType]; 
    cell = newCell;
    [cell styleWithElement:element andResubItem:resubItem];

my problem is, I need another way to create a custom-styled cell from the storyboard than the quouted above – I have no XIB and the above way is the only way I know to create my cell.
Could it be a solution to create a celltype once the above way and then copy the cell? Is there a way to copy a cell-object?

  • 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-27T01:26:36+00:00Added an answer on May 27, 2026 at 1:26 am

    You can generate a random cell ID each time so it won’t be reused.

    However, that would not be very good for scroll performance and memory consumption, so consider actually reusing the cells (i.e. come up with a way to replace data in them).

    Edit:

    you can always just copy the views from one to another, something along these lines:

    UITableViewCell* myCell = [UITableViewCell alloc] initWithStyle:YOUR_CELL_STYLE reuseIdentifier:YOUR_RANDOM_ID];
    for (UIView *view in newCell.subviews) {
        [view removeFromSuperview];
        [myCell addSubview: view];
    }
    

    You may also need to adjust the frame of myCell to be the same as that of newCell, and if newCell is an action target for any events (e.g. clicking a control element within the cell triggers some action defined in the cell class) you’ll need to reassign those to the myCell, too.

    Edit2:

    To move actions you could do something like this:

    NSSet* targets = [control allTargets];
    for(id target in targets) {
    
        NSArray* actions = [control actionsForTarget:target forControlEvent:UIControlEventTouchUpInside];
        for(NSString* selectorName in actions) {
        [newControl addTarget:target action:NSSelectorFromString(selName) forControlEvents:UIControlEventTouchUpInside];
        }
    }
    

    Substitute your new cell for the target – and make sure it implements all the necessary selectors (or you can put a new selector). The code above will replace targets for UIControlEventTouchUpInside – you can use the ones you need instead (or use allControlEvents to enumerate the ones used by a control).

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

Sidebar

Related Questions

I am building an app using storyboard. I have added a table view to
In my app I have a scroll view and four table views. Each time
In my iPhone app I have a table view where I add a tick
I have an app that presents Table View of different files. I have it
I have a working table view on my iphone app, and am implementing a
I have a categories table view controller. In my app, categories can have subcategories.
I have an iPhone app which has a Table View-based data input screen with
Hello! I tried create an app from that website: http://www.appcoda.com/customize-table-view-cells-for-uitableview/ There we created a
I have an app which uses a table view to display a list of
I am trying to create a table view which uses two types of cells

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.