Enable user to select location from drop down or map? - ios

I have an app that automatically gets the user's location via GPS if enabled, but I'd like to provide an option to allow the user to manually input the location. I'm not sure how this can work form a UX or technical perspective. Below is my screenshot from my table.
If the user disables Automatic, I'm not sure what the best way for the table to react or what controls to use. Should I open a modal view and display drop downs for the user to select their: country > Province > City? Or maybe to allow them to place a pin on a map? Could it be very simple to implement a text box that allows the user to enter an address then I can geocode it instead? I eventually want to end up with coordinates in my app code.
What kind of data or services do I need to accomplish this? It's a small feature, but I'm finding it to have many factors involved. Any help or advice would be greatly appreciate!

I would suggest implementing a UIMapView with 1. a UISearchBar above it 2. a UIButton that pings the user to their current location, to the right of the searchBar and above the mapView 3. an 'Add Location' button at the bottom left of the mapView and 4. a 'Cancel' button at the bottom right of the mapView. The 'Add Location' button would use the center coordinate of the map.
When a user switches from 'Automatic' to 'Manual' put a button to the right of the label that says 'Add Location' or 'Update Location'. Pressing this button would animate the previously discussed view to sweep in, or however you want to animate it.
Good luck with your design!

Related

How to delete item from Swift UI List in UI Test

Is it possible to delete a Swift UI List item from a UI test?
For the user they can press the edit button which puts the list into edit mode (screenshot 1), then press the red circle with the white line, then press Delete.
Alternatively the user can swipe delete the list item.
Even with the accessibility inspector on I can't see what the icon is (the red circle with the white line). It doesn't show anything when I hover over it. Also the recorder doesn't record anything if I try using that tool.
If I try with .swipeLeft() to try to delete using the swipe gesture instead, it actually "taps" on the list button instead of swiping and just opens the detail view.
Any ideas? What am I missing here? Or is this not actually possible?
Ok I found a way to make it work with the swipe method. It's pretty simple. Just need to let the test know to swipe a bit slower.
app.staticTexts["Test"].swipeLeft(velocity: XCUIGestureVelocity.slow)
Using that I'm able to then tap on the delete button and assert that the item is gone.
I'm not super fussed right now about the other method, as long as there's a way to test deleting (and as long as I'm allowing swipe delete). However would be good to know if someone has the answer.

How to hide components when clicking outside your area

I have a form with green edit, when the user clicks the search button, the components in red are displayed on the screen. But I want that when the user clicks out of the component area, they disappear. I have no idea how to do this. I saw some people using a layout to cover the whole screen, but wanted to know if there was another way.
Or use the
OnFormclick event with object.visible:=false;

VoiceOver : is 'accessibilityActivationPoint' really useful?

I tried and understood what could be the purpose of the accessibilityActivationPoint but in vain.
When a focused accessible element is activated, that property should indicate VoiceOver the specific area it's going to activate when a user double-taps the element (Apple reference) : for me, it's always the selected element itself.
I understood the selected element is considered as a block by VoiceOver, whatever the other elements inside. Once a double tap occurs to activate this block, VoiceOver calls accessibilityActivate to know what to perform (Apple reference).
1/. I've written many tests by creating a custom view including a switch control. Whatever the value of accessibilityActivationPoint inside (or outside on another switch control), the value of the switch control never changes. Is it a proper use case or am I totally wrong ?
2/. When we gather many elements inside one accessible element, how is VoiceOver able to activate one of them while they aren't accessible by definition ? Pointing one of them thanks to the accessibilityActivationPoint should work ?
Personally, I couldn't make it work and think that I'm really confusing accessibilityActivationPoint and accessibilityActivate.
Any help would be appreciated, thanks in advance.
Yes, you have the right idea with accessibilityActivate and accessibilityActivationPoint. Note that, in order for it to work, the accessibilityActivationPoint needs to be a point within the Control that you are trying to activate in on-screen coordinates (use the convert function!).
I think the short answer is "yes" to answer your second question, but, just to clear up confusion about when Accessibility Activation Point is useful, I'll go into more detail about it.
By default (aka, the default behavior for AcessibilityActivate()), when any view is activated by VoiceOver, VoiceOver will send a "tap gesture" to the center of the view. The position of this "tap gesture" can be changed by updating the accessibilityActivationPoint attribute on a view. Below, I have an example for how this property can be used.
Let's say you have a blank button (in the image below, the button is the gray box) next to some text:
For the purpose of accessibility, you may want to make the entire view that holds the button and text an Accessibility Element (so that VoiceOver users can easily understand that the button is associated with the text "Worldspace Attest"). In the image below, I am using Accessibility Inspector to show that the view holding both of these elements is an Accessibility Element.
Notice in these images that the button is not in the center of the view, but rather, it is to the right. When you activate this view using VoiceOver, the view will not select the button; instead, it will send a "tap" to the center of the view (which is the same as tapping the text, which does not do anything). In order to select the button, you have to set the view's accessibilityActivationPoint to be the on-screen coordinates of the button:
view.accessibilityActivationPoint = self.convert(button.center, to: UIApplication.shared.windows.first)
This should make it so that this button is usable by a VoiceOver user.
I hope this information clears up any confusion about the Accessibility Activation Point property. The example I used above can be found in this repository in the "Active Control Name" demo.

how to implement non-modal dialog in IOS like this (image attached)?

Question: How would one best implement non-modal dialog in IOS like this (image attached)? Allow ability to drag move map still and select (long press) another location, which then that detail is populated in the pop-up "non-modal" dialog. Dialog can have ability to "delete" / "add to favourites" etc.
To clarify:
I'm asking how to implement the dialogs in the image I have marked "Non Modal Popup"
so for the iPad/horizontal regular case, I'm highlighting the dialog would be associated with the ViewController on the right, so therefore in this case the user could still drag the map within VC2, but also access/use VC1 as well
Some notes re my pondering:
can UIViewController.present NOT be used here as it is modal? If it can be used what settings to get this working?
it not would you recommend using an (a) separate UIViewControllerto implement, and show it up using the manual means of adding a UIViewController, OR (b) is it better to just keep it as a UIView in this case? In either of these cases one would have to do any adaption programmatically?

How to delete a polygon on map

I implemented a map using apple's native f/w and I have implemented the functionality to add some polygons over the map. Now, I want to have a "close" button at the edge of the each polygon and when I click on that button, i need to delete the polygon (one polygon at a time). I have tried creating a button over the polygon edge, but I was unable to make an action on clicking the button. I have tried with annotations as well. In this case, I am unable create a close button over all the polygons; I could able to have the close button (annotation) only on the last polygon which was created but when I click on the button, the polygon which was created first only was getting deleted.
Kindly suggest me a solution to have a close button on each polygon, and to delete a polygon(one by one) on clicking the button.

Resources