Add checklist to UIAlertController

I work with UIAlertController .

Now I can list an element 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 the list by clicking a button in the UIAlertController in the format shown below:

http://imgur.com/bMu2GUc

0
source share
1 answer

What you showed in the picture is complicated and cannot be implemented using a simple UIAlertController.

To play the screenshot you need

  • Learn how to show ViewController as a popup
  • Add UITable to ViewController
  • Show items in UITable
  • Customize UITable by adding custom cells
  • In each of the user cells add a button
  • This button will have two types of images, one empty box and another box with a check mark.
  • When the user touches a table cell, you need to change the button image corresponding to this table row, so the user believes that they check or uncheck
  • and finally add the Finish button at the bottom to close the view manager

Google all of these elements for tutorials. As I said, this is not an easy task, since Xcode does not have a checkmark function.

0
source

Source: https://habr.com/ru/post/1012409/


All Articles