Questions tagged [uiaction]
12 questions
11
votes
1 answer
How to change text and background color UIMenu | UIAction (Swift 5)
Please tell me how to customize this menu?
Perhaps another way to do it?
let barMenu = UIMenu(title: "", children: [
UIAction(title: NSLocalizedString("menu_item_home", comment: "")){
action in
…

IamFromUSSR
- 121
- 5
6
votes
2 answers
How to manually change the selected UIAction inside UIMenu?
The Goal:
Trying to create a filter selection screen (in a card view) that has UIButtons with UIMenu items attached them.
When i select any of the filters, and click on the apply filters button, i dismiss the filter view controller and go back to…

GameDev
- 445
- 7
- 21
6
votes
2 answers
iOS 14 Context Menu from UIView (Not from UIButton or UIBarButtonItem)
There is an easy way to present a context menu in iOS 13/14 via UIContextMenuInteraction:
anyUIView.addInteraction(UIContextMenuInteraction(delegate: self))
The problem for me with this is that it blurs out the whole user interface. Also, this only…

Gizmodo
- 3,151
- 7
- 45
- 92
3
votes
5 answers
How to programmatically present a menu when single-tap a table view row, like in the iOS 16 Calendar app?
In the iOS 16 Calendar app, there is a new drop-down menu style for options like "repeat", when tapping any place of the row, a menu appeared. And there is a chevron up and chevron down icon at the right side of the table view cell.
How to do this…

zgjie
- 2,099
- 2
- 21
- 32
3
votes
1 answer
Why is the new iOS 14 UIControl action syntax so terrible?
New in iOS 14, we can attach an action handler directly to a UIControl:
let action = UIAction(title:"") { action in
print("howdy!")
}
button.addAction(action, for: .touchUpInside)
That's cool in its way, but the syntax is…

matt
- 515,959
- 87
- 875
- 1,141
3
votes
0 answers
How can I use suggestedActions given from UIContextMenuConfiguration?
Other than the a WWDC video - 44:18 a sample project there's not much info online.
So the actionProvider, when called, has a list of suggestedActions
that are passed to it by the system.
This can be a mix of UIMenus and UIActions, so potentially…

mfaani
- 33,269
- 19
- 164
- 293
2
votes
1 answer
In iOS 14 how do you tap a button programmatically?
In iOS 14 I have configured a button to display a menu of questions. On its own the button is working perfectly. Here’s how it’s configured:
let button = UIButton()
button.setImage(UIImage(systemName: "chevron.down"), for:…

Murray Sagal
- 8,454
- 4
- 47
- 48
1
vote
1 answer
How do I change the color of an SF Symbols based UIButton embedded in a UIAction?
I'm generating a button with the following code but am unable to successfully change the button's foreground color.
let button = UIButton(
type: .close,
primaryAction: UIAction(
image: UIImage(systemName: "x.circle"),
…

pinglock
- 982
- 2
- 12
- 30
1
vote
3 answers
Does iOS 13 - UIMenu have a bug that doesn't show its image?
Paste the following code into a project:
No image shows next to 'Device Honey' ie the UIMenu
However the image shows up next to 'Copy' ie the UIACtion.
Am I doing something wrong? If this is a bug? Is there a workaround?
class ViewController:…

mfaani
- 33,269
- 19
- 164
- 293
0
votes
3 answers
How to create a UIButton programmatically in iOS 14 in objective-C?
I'm trying to create a UIButton programmatically in iOS 14 (beta 3) in objective-C. This is what I've tried, but the UIAction handler is never called when I tap the button:
UIAction *tapAction = [UIAction actionWithHandler:^(UIAction* action){
…

krause5612
- 1
- 3
-1
votes
2 answers
UIAction calling multiple times when tapped on UIButton in CollectionViewCell
When I tap on button it will trigger multiple times.
CollectionViewCell file code
class PhotoCell: UICollectionViewCell {
@IBOutlet weak var deleteButton: UIButton!
}
ViewController - cellforItemAt method implementation
func collectionView(_…

Yogesh Patel
- 1,893
- 1
- 20
- 55
-2
votes
1 answer
How to have an initial state with no option selected with UIButton (popup/pulldown button)?
I have this particular code
let genderOptions = ["Male".localized, "Female".localized]
.map { UIAction(title: $0, state: .off, handler: {_ in }) }
genderButton.changesSelectionAsPrimaryAction = true
genderButton.menu = UIMenu(children:…

Burhanuddin Sunelwala
- 5,318
- 3
- 25
- 51