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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 26, 20262026-05-26T12:19:20+00:00 2026-05-26T12:19:20+00:00

I have 3 segmented controls in each cell of a tableview on an iPad.

  • 0

I have 3 segmented controls in each cell of a tableview on an iPad. The orientation is always landscape for the app and the number of cells vary for each run on the app. The app performs fine if the number of rows are around less than 10, but anywhere above that, the glitches start to appear.

For the kind of application I’m building, I could have as many as 70 rows ==> meaning, 210 UISegmentedControls, all alloced in the memory at once.

Is there a work around? Is there a way I can reuse these UISegmentedControls? If yes, how can I preserve the state of the segmented control?

Otherwise, can anybody propose a new solution? (Each segmented control has items ‘A’ and ‘B’ and there are three segmented controls representing three different parameters for each object corresponding to each row of the table).

UPDATE:

Here’s the code:

- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath
{
    static NSString *CellIdentifier = @"Cell";

    UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:CellIdentifier];
    if (cell == nil) 
    {
        cell = [[[UITableViewCell alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier:CellIdentifier] autorelease];
    }

    // Configure the cell...
    segmentedControl1 = (UISegmentedControl*)[array1 objectAtIndex:[indexPath row]];
    segmentedControl1.frame = CGRectMake(180, 15, 100, 30);
    [cell.contentView addSubview:segmentedControl1];

    segmentedControl2 = (UISegmentedControl*)[array2 objectAtIndex:[indexPath row]];
    segmentedControl2.frame = CGRectMake(450, 15, 100, 30);
    [cell.contentView addSubview:segmentedControl2];

    segmentedControl3 = (UISegmentedControl*)[array3 objectAtIndex:[indexPath row]];
    segmentedControl3.frame = CGRectMake(725, 15, 100, 30);
    [cell.contentView addSubview:segmentedControl3];

    cell.selectionStyle = UITableViewCellSelectionStyleNone;

    return cell;
}
  • 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-26T12:19:21+00:00Added an answer on May 26, 2026 at 12:19 pm

    Create a custom UITableViewCell subclass. Have three properties in it for your three UISegmentedControls and add them in the init method:

    @interfate MyCell : UITableViewCell
    @property (nonatomic, retain, readonly) UISegmentedControl *control1;
    @property (nonatomic, retain, readonly) UISegmentedControl *control2;
    @property (nonatomic, retain, readonly) UISegmentedControl *control3;
    @end
    
    @implementation
    
    @synthesize control1 = _control1;
    @synthesize control2 = _control2;
    @synthesize control3 = _control2;
    
    - (id)init
    {
    if ((self = [super init]))
    {
        _control1 = [[UISegmentedControl alloc] init...];
        _control1.frame = CGRectMake(...);
        [self addSubView:_control1];
    
        // repeat with control2 & control3
    }
    //...
    @end
    

    Then, rather than storing arrays of UISegmentedControls you can then have arrays of NSNumber holding the selected index.

    You’d then do something like:

    cell.control1.selectedIndex = [[array1 objectAtIndex:indexPath.row] integerValue];
    

    You could also create custom objects to hold this data and store them in one array.

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

Sidebar

Related Questions

I have an iPad app with several segmented controls, including one view with two
I have a segmented control on the top of a tableView that I would
I have 2 segmented controls in my viewcontroller view. How can I handle the
I'm using Backbone.js have a segmented control-type UI element for each model's view. They
How to navigate web pages with the help of segmented controls? I do have
I am developing an iphone app in which i have a segmented control that
I have three UISegmented controls (In a utility application), each of which store their
I have a segmented control where the user can select how to order a
I'm trying to write a basic DST converter. I have a segmented control with
I have a UIScrollView that contains an image and a segmented control that allows

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.