1

I am working with the UIAlertController.

Right now I am able to list an item from the following code:

{
  UIAlertController *controller = [UIAlertController alertControllerWithTitle: @"Beds"
                                                                            message: @""
                                                                     preferredStyle: UIAlertControllerStyleAlert];
        [controller.view setBackgroundColor:[UIColor clearColor]];
        [controller.view setTintColor:[UIColor blackColor]];

        for (int a=0;a<[bedsCount count];a++)
        {

            UIAlertAction *button = [UIAlertAction actionWithTitle: [bedsCount objectAtIndex:a]
                                                             style:UIAlertActionStyleDefault
                                                           handler:^(UIAlertAction *action)
                                     {
                                         [bedSelectionText setTitle:[bedsCount objectAtIndex:a] forState:UIControlStateNormal];


                                     }];
            [controller addAction: button];
        }

I want to show list on button click in UIAlertController in format shown in below link:

https://i.stack.imgur.com/0pRXT.jpg

Maddy Barakz
  • 11
  • 1
  • 7
  • We can help you if you post the image even a link first, you can use http://imgur.com/ to upload the images. Because the first problem here is the actual UI you wanted, not in code 'cause your code is fine... And there's no checkbox in iOS but there are many other way to create what you want – Pepeng Hapon Aug 11 '15 at 10:39
  • @pepeng here is the link of the image http://imgur.com/bMu2GUc – Maddy Barakz Aug 11 '15 at 11:16
  • Were you able to implement it? I sitll can't find how to just add a checkbox in UIAlertController – A_G Dec 29 '16 at 06:42

1 Answers1

2

What you had shown in the picture is complicated and cannot be implemented with a simple UIAlertController.

In order to replicate your screenshot what you need is

  • Learn how to show a ViewController as a pop-up
  • Add UITable to a ViewController
  • Show items in a UITable
  • Customize the UITable by adding custom cells
  • In each of the custom cells add a button
  • That button will have two kinds of images, one blank box and the other box with a check mark
  • when user touches a table cell you need to change the button image corresponding to that table row so the user thinks they are checking or unchecking the box
  • and lastly add a done button at the bottom to dismiss the viewcontroller

Google all these items for tutorials. As I said this is not a simple task as there is no out of the box check mark function in Xcode.

Sam B
  • 27,273
  • 15
  • 84
  • 121