@tiger_13

Как называется этот элемент в swift?

Подскажите, пожалуйста, как называется этот элемент (кнопки, которые появляются внизу) в swift, и как их вызвать в коде?

5d81ab4c53c98649862476.jpeg
  • Вопрос задан
  • 187 просмотров
Решения вопроса 1
@iMaximus
Раньше UIActionSheet сейчас UIActionController, если не ошибаюсь, а там уже что хотите делайте. Кнопки или что то другое.
Ответ написан
Комментировать
Пригласить эксперта
Ответы на вопрос 1
SnapSh0t
@SnapSh0t
iOS-Developer
1*nUOQv3AjroYhqdfnMTj-pA.jpeg
Alert
1*Apo2oPX3FytJSikiNQEX-Q.jpeg
func showSimpleAlert() {
        let alert = UIAlertController(title: "Sign out?", message: "You can always access your content by signing back in",         preferredStyle: UIAlertControllerStyle.alert)

        alert.addAction(UIAlertAction(title: "Cancel", style: UIAlertActionStyle.default, handler: { _ in
            //Cancel Action
        }))
        alert.addAction(UIAlertAction(title: "Sign out",
                                      style: UIAlertActionStyle.default,
                                      handler: {(_: UIAlertAction!) in
                                        //Sign out action
        }))
        self.present(alert, animated: true, completion: nil)
    }

ActionSheet
1*jGNiuYQJkck_Nvv3Ir06fg.jpeg
func showSimpleActionSheet(controller: UIViewController) {
        let alert = UIAlertController(title: "Title", message: "Please Select an Option", preferredStyle: .actionSheet)
        alert.addAction(UIAlertAction(title: "Approve", style: .default, handler: { (_) in
            print("User click Approve button")
        }))

        alert.addAction(UIAlertAction(title: "Edit", style: .default, handler: { (_) in
            print("User click Edit button")
        }))

        alert.addAction(UIAlertAction(title: "Delete", style: .destructive, handler: { (_) in
            print("User click Delete button")
        }))

        alert.addAction(UIAlertAction(title: "Dismiss", style: .cancel, handler: { (_) in
            print("User click Dismiss button")
        }))

        self.present(alert, animated: true, completion: {
            print("completion block")
        })
    }
Ответ написан
Комментировать
Ваш ответ на вопрос

Войдите, чтобы написать ответ

Войти через центр авторизации
Похожие вопросы