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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 17, 20262026-05-17T19:25:27+00:00 2026-05-17T19:25:27+00:00

i want to display the table view in alert view. This table view contains

  • 0

i want to display the table view in alert view. This table view contains segmented control.
these segmented controls are for on/off the audio, image, text. so there will be 3 cells with segmented controls.

how to do this

please help me out

Thank u

  • 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-17T19:25:27+00:00Added an answer on May 17, 2026 at 7:25 pm

    Adding UISegmentedControls (or UISwitches, which I would personally recommend for a simple on/off option) is easy enough to put in table view cells using the accessoryView property.

    Your view controller (or whatever object you’re using to control this thing) must implement the UITableViewDataSource protocol.

    @interface MyViewController : UIViewController<UITableViewDataSource, UITableViewDelegate> {}
    @end
    

    Add the controls in tableView:cellForRowAtIndexPath:

    - (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath {
        static NSString* const SwitchCellID = @"SwitchCell";
        UITableViewCell* aCell = [tableView dequeueReusableCellWithIdentifier:SwitchCellID];
        if( aCell == nil ) {
            aCell = [[[UITableViewCell alloc] initWithFrame:CGRectZero reuseIdentifier:SwitchCellID] autorelease];
            aCell.textLabel.text = [NSString stringWithFormat:@"Option %d", [indexPath row] + 1];
            aCell.selectionStyle = UITableViewCellSelectionStyleNone;
            UISwitch *switchView = [[UISwitch alloc] initWithFrame:CGRectZero];
            aCell.accessoryView = switchView;
            [switchView setOn:YES animated:NO];
            [switchView addTarget:self action:@selector(soundSwitched:) forControlEvents:UIControlEventValueChanged];
            [switchView release];
        }
    
        return aCell;
    }
    

    Or, if you’re set on segmented controls, replace the UISwitch stuff above with something like:

        UISegmentedControl *segmentedControl = [[UISegmentedControl alloc] initWithItems:[NSArray arrayWithObjects:@"On", @"Off", nil]];
        segmentedControl.autoresizingMask = UIViewAutoresizingFlexibleWidth;
        segmentedControl.segmentedControlStyle = UISegmentedControlStylePlain;
        segmentedControl.frame = CGRectMake(75, 5, 130, 30);
        segmentedControl.selectedSegmentIndex = 0;
        [segmentedControl addTarget:self action:@selector(controlSwitched:) forControlEvents:UIControlEventValueChanged];
        aCell.accessoryView = segmentedControl;
        [segmentedControl release];     
    

    I would personally put these options in a regular view (probably accessible from an options button which does the flip transition, like many iPhone apps do). I don’t think putting it in an alert view is a very good user experience.

    However, I have written a few blog posts showing how to put various views into alert views (text field, which is kinda useful, and web view, which is arguably not).

    So, if you’re really dead set on putting this in an alert view, you can totally do that, like this:

    - (void) doAlertWithListView {
        UIAlertView *alert = [[UIAlertView alloc] initWithTitle:@"Preferences" 
                                                        message:@"\n\n\n\n\n\n\n"
                                                       delegate:self 
                                              cancelButtonTitle:@"Cancel"
                                              otherButtonTitles:@"OK", nil];
    
        UITableView *myView = [[[UITableView alloc] initWithFrame:CGRectMake(10, 40, 264, 150) 
                                                            style:UITableViewStyleGrouped] autorelease];
        myView.delegate = self;
        myView.dataSource = self;
        myView.backgroundColor = [UIColor clearColor];
        [alert addSubview:myView];
    
        [alert show];
        [alert release];    
    }
    

    It will look something like this:

    UIAlertView with a UITableView

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

Sidebar

Related Questions

I want to display a thumbnail image in a cell of tableViewController , this
I want to display an image within a scroll area. The view port of
I don't want to display my table view cells until the data has been
hi i have data in my table view and i just want to display
I want to display an indexed table view. By default, section index titles have
I want to display the TIME field from my mysql table on my website,
I have a Database table that I want to display in a DataGridView. However,
I m using a dropdown to display Location field of a table. I want
I want to display the current host and database names in a view. Where
i want to display many images like thumbnails in a scroll view and and

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.