How to implement action buttons around circular group in Apple Watch - ios

I would like to implement an interface where the buttons need to be placed around a circular group object. All buttons need to be arranged around the circle in the circular order. It is similar to contacts interface provided by Apple Watch while side button is pressed. I keep thinking how apple would have implemented that. Watchkit framework doesn't allow the developer to set X&Y of the UI elements to position whereever we want. It would be great if someone can help me on how to do this technically.
PS:I need buttons around the circle as they have to be actionable.

Related

How to implement a left-to-right swipe in a SwiftUI list?

I'm building a to-do app in Swift as a practice project, and would like to make it so that when the user swipes from left to right on a task in the list, my "completed" boolean in the task becomes true. Similar how in the native Mail app, swiping right on an email marks it read.
I came across the onDelete() function provided by Apple that handles right to left swipes, but as far as I can tell there's no code for left to right swipes. I think that makes it ok to implement a left to right swipe, but I can't find any examples of how to do so in SwiftUI. I think this question was asked once on Stack Overflow here, but the answer only pertained to deleting and moving.
that called gestures and for swipe gesture you can see the documentation here - https://developer.apple.com/documentation/uikit/uiswipegesturerecognizer
and if you don't want to make it from scratch then you can use library for it and the kind of functionality you want go for this library SwipeCellKit here is link https://cocoapods.org/pods/SwipeCellKit with this you can easily make the kind of functionality you want.
iOS 15
You can define any number of actions with .swipeActionis modifier for either leading, or trailing side of the cell with the given view as the label and give them a tint color like:

MFi Controller center button element?

I am attempting to implement MFi controller compatibility with my project and all is going well so far. Apple's documentation notes that for the GCExtendedGamepad class (which is the one I care about) there are several button elements:
The controls associated with the extended gamepad profile include the following:
Two shoulder buttons.
Two triggers.
Four face buttons arranged in a diamond pattern.
One directional pad.
Two thumbsticks.
However, there is one last button right in the center of the thing. On my Nimbus controller it's a button labeled "Menu" but the diagram included in the official documentation page shows it as a pause button. Either way, I see no further mention of this button or any means of accessing it. Is there any way to handle input for this button specifically?

How do I place a button inside of an image?

Is it possible to place a UIButton inside of a UIImage with the Apple Watch? It seems that I can only place objects beside each other rather then on top of them as I can with iOS
As far as I know you can not do that.
But what you can do is to create a button and set it's backgroundImage.
Hope that helps :)
Short answer, you can't really place items on top of each other with WatchKit, but you can use the background image of a group to do it:
Can I position interface elements on top of each other?
No, interface elements can’t be positioned on top of each other natively. However, there are workarounds. For example, you can use a WKInterfaceGroup and set its background image to something that represents the control you want to overlay. Inside the group you can then add the necessary labels, buttons and so on.
This comes from Ray Wenderlich's WatchKit FAQ, which is a pretty reliable source. I'll link to fully official sources if I find it.
The solution is, as stated above, to use a WKInterfaceGroup and set its background image to something that represents the control you want to overlay. Inside the group you can then add the necessary labels, buttons and so on.
Note that this question also is about laying elements on top of images.

What makes an element accessible? And why are tap gestures less accessible than UIButtons? How do I fix it?

Brent Simmons wrote in a blog post that tap gesture recognizers, presumably on a UIView, are less accessible than UIButtons. I'm trying to learn my way around making my app accessible, and I was curious if anyone could clarify what makes that less accessible than a UIButton, and what makes an element "accessible" to begin with?
For more customizability I was planning to build a button comprised of a UIView and tap gesture recognizers with some subviews, but now I'm not so sure. Is it possible to make a UIView as accessible as a UIButton?
Accessible in this context most likely refers to UI elements that can be used using Apple's accessibility features, such as VoiceOver (see example below).
For example, a visually impaired person will not be able to see your view or subviews, or buttons for that matter; but the accessibility software "VoiceOver" built into every iOS device will read to her/him the kind of object and its title, something like "Button: Continue" (if the button title is "Continue").
You can see that most likely the tap gesture recognizer will not be read by VoiceOver and thus be less "accessible".

Implementing round buttons

I am building a simple app that displays a grid, similar to a guitar neck, and I wanted to draw oval buttons at each intersection of the grid, and attach behaviors to it, like tapping once for sound. Pretty straight forward stuff...
My question is about the use of class for the buttons.
I am able to draw some good looking buttons with UIBezierPath/bezierPathWithOvalInRect:
and now I want interactivity. I read in this forum from one developer that he used a button underneath an image to capture user interaction. I have tried that but I cannot fade out the button all together, as interaction is removed altogether.
Is it possible to draw rounded buttons with UIButton from interface builder?
What is best practice for something simple like drawing rounded buttons and capturing user interaction?
you can try layer.cornerRadius using the QuartzCore framework.
Or, just use an image as a custom button.

Resources