Программируем под IOS
Anonymous
Как представить лист действий без стрелки из UIButton в iOS 26?
Сообщение
Anonymous » 19 ноя 2025, 02:20
Я пытаюсь представить лист действий из обычного UIButton на iOS 26 без показа всплывающей стрелки.
Что я пробовал до сих пор:
Я смотрел сеанс WWDC 2025 «Создание приложения UIKit с новым дизайном»: https://developer.apple.com/videos/play/wwdc2025/284/ .
В видео они установили sourceItem с помощью элемента кнопки панели, который правильно показывает отсутствие стрелки. Я пробовал использовать тот же подход с обычным UIButton, но стрелка по-прежнему отображается.
Проверил документацию Apple: https://developer.apple.com/documentati ... ion-sheets
Отключение стрелки с помощью:
Код: Выделить всё
alertController.popoverPresentationController?.permittedArrowDirections = []
или:
Код: Выделить всё
alertController.popoverPresentationController?.permittedArrowDirections = UIPopoverArrowDirection(rawValue: 0)
скрывает стрелку, но нарушает анимацию листа действий — лист появляется мгновенно, а не плавно скользит вверх.
Вот код, который я использую:
Код: Выделить всё
@IBAction func buttonTapped(_ sender: UIButton) {
let action = UIAlertAction(title: "Action", style: .destructive)
let alertController = UIAlertController(title: nil, message: "Message", preferredStyle: .actionSheet)
alertController.addAction(action)
alertController.popoverPresentationController?.sourceItem = sender
alertController.popoverPresentationController?.permittedArrowDirections = UIPopoverArrowDirection(rawValue: 0)
present(alertController, animated: true)
}
Ожидаемый результат: https://drive.google.com/file/d/1ItU2lt ... sp=sharing
Фактический результат:
https://drive.google.com/file/d/1ItT8Ab ... sp=sharing
Подробнее здесь:
https://stackoverflow.com/questions/798 ... -in-ios-26
1763508022
Anonymous
Я пытаюсь представить лист действий из обычного UIButton на iOS 26 без показа всплывающей стрелки. Что я пробовал до сих пор: [list] [*]Я смотрел сеанс WWDC 2025 «Создание приложения UIKit с новым дизайном»: https://developer.apple.com/videos/play/wwdc2025/284/. В видео они установили sourceItem с помощью элемента кнопки панели, который правильно показывает отсутствие стрелки. Я пробовал использовать тот же подход с обычным UIButton, но стрелка по-прежнему отображается. [*]Проверил документацию Apple: https://developer.apple.com/documentation/uikit/getting-the-user-s-attention-with-alerts-and-action-sheets [*]Отключение стрелки с помощью: [code]alertController.popoverPresentationController?.permittedArrowDirections = [][/code] или: [code]alertController.popoverPresentationController?.permittedArrowDirections = UIPopoverArrowDirection(rawValue: 0)[/code] скрывает стрелку, [b]но нарушает анимацию листа действий[/b] — лист появляется мгновенно, а не плавно скользит вверх. [*]Вот код, который я использую: [code]@IBAction func buttonTapped(_ sender: UIButton) { let action = UIAlertAction(title: "Action", style: .destructive) let alertController = UIAlertController(title: nil, message: "Message", preferredStyle: .actionSheet) alertController.addAction(action) alertController.popoverPresentationController?.sourceItem = sender alertController.popoverPresentationController?.permittedArrowDirections = UIPopoverArrowDirection(rawValue: 0) present(alertController, animated: true) } [/code] [*]Ожидаемый результат: https://drive.google.com/file/d/1ItU2lta3NajUZ9DRMqqzFGWcrUswWYBZ/view?usp=sharing [*]Фактический результат: https://drive.google.com/file/d/1ItT8AbmevbXhvLT2un_hJj7u1kmstiOY/view?usp=sharing [/list] Подробнее здесь: [url]https://stackoverflow.com/questions/79823345/how-to-present-an-action-sheet-without-an-arrow-from-a-uibutton-in-ios-26[/url]