I want to enable Peek&Pop, and include 3D Touch actions for iPhone 6s & up users, however I also want to enable a long press to enter non-3D Touch users into the Action sheet.
I understand how to use the peek and pop delegate methods, and I understand how to create a long press gesture. What I need to know is how to connect the long press action to display the peek preview with actions showing.
From all that I can find online and in documentation, I now believe that Apple does not allow you to show the 3D Touch UI on non-3D Touch devices. While the other answer here is a decent alternative (implementing a long press to do an action on non-3D Touch), there is no current answer to my original question.
Related
Is there a way to register multi-touch as a single touch? Say if I use three fingers to tap a large button, can it be registered as simply one tap of the button? -- the current default appears to treat it as a multi-touch, and as a result ignores the button-pressing altogether. Similarly, if I use my palm to tap a large button, the button isn't pressed either.
I noticed in iphone Accessibility Settings -> Touch Accommodations, one could set "Ignore Repeat" and "Use Initial Touch Location" for tap assistance. Of course, if those are turned on, it affects the entire phone instead of just one app. But would that be the direction to approach this problem?
BTW I don't actually need multi-touch in my app. So if turning off multi-touch can be more simply done on the whole-app level instead of button-by-button, it would suit this case very well.
Thank you #DonMag for providing a hint.
So, if yours is an ios app from Capacitor, here is how to change your javascript code:
Change your button onClick events into "onTouchStart"
Use a state variable to keep track of whether "onTouchStart" is triggered and the resulting logic is executing. During that execution, prevent more touch events to have further effect on the button. This is to prevent the button from being pressed in quick succession by multiple touches that come from, say, your three-finger tap or palm tap. Only after the execution is finished do you revert the state variable back to the original value, so that the button is ready to be pressed again.
If there is an answer that's more suitable for the native Swift bundle I'll accept that as the answer. The above is just to help anyone who may encounter the same problem as mine.
I am trying to take screenshots of my iOS app. Before taking a screenshot, I need to get the app to an appropriate state. To get to an appropriate state, a lot of swiping is required.
This would have been fine if I have actual devices, but I don't. So I need to perform swipes on a simulator using a trackpad. I find this very hard, and sometimes I can't swipe properly so the gesture is not recognised.
I thought of using the UI Testing library to programmatically perform swipes. However, my app is actually a game, and random events happen. Writing code to handle these random events would not be worth the time. It would be best if I am in control of the swiping.
I have also thought of adding buttons on the UI of the app. When they are pressed a swipe is simulated. Then I can just click those buttons instead of swiping with my trackpad, which is way easier. However, these buttons will then appear on the screenshot, which I obviously don't want users to see.
Also note that I can't use a tap gesture recogniser as a replacement for the swipe gesture recognisers, because I need to detect swipes in all four directions and do different things depending on the direction.
Essentially, how can I perform a "swipe" more easily on the simulator? It would be great if I can do this by pressing keys on my keyboard, or maybe there is a feature in Xcode that allows me to do this which I am not aware of?
I suggest you automate the UI test.
Recording a test from live actions is a standard Xcode UI test feature. Fastlane is the icing on the cake to automate the capture of screenshots too.
Fastlane has the tools to automatically run a UI test and capture screenshots in all device resolutions. You can even record the actions by recording a UI test and play it back.
Check it out here:
Fastlane Screenshot
Even if you do not wish to use Fastlane, you can record the gestures in a unit test and have it pause.
I'd like to perform an action when the user has their finger held on the screen when my app startups.
To give an example: When the App launches and the launch screen is showing up, the user has a finger on the screen as long as the first ViewController appears. When the first ViewController gets into the viewDidAppear() function, I want to detect, that the users finger is on the screen and perform an action, like f.ex. jumping straight into the lastest received email. Basically this is supposed to be a kind of shortcut to an main action.
Is there any method to detect an already laying finger on the screen? To be exactly I'd like to check for the tap in viewDidAppear()
Unless the nature of Time has changed since the last time I checked, your app cannot detect what the user was doing before the app launched. The app, ex hypothesi, was not running at that time. And the mere presence of a finger on the screen during app launch will not generate a touch event that the app can detect.
The system can detect it, however, since is running before your app launches. That is why Apple added force-touch Shortcuts (for appropriate hardware). The only way you can do what you're asking is to rely on that API. Hardware that lacks this feature will simply have to do without this feature.
(After all, this is how Apple makes money: by trying to make users jealous of hardware they don't have, so that they buy new hardware. You would want to rob Apple of its income by reading this feature backwards onto old hardware, even if you could, now would you?)
I am creating a GKTurnBasedMatch Game Center-enabled app. I've successfully implemented GKLocalPlayerListener methods to listen for events, such as player:receivedTurnEventForMatch:didBecomeActive: and other methods. Additionally, if a user taps on an existing match in the GKTurnBasedMatchmakerViewController (for example, if showExistingMatches is set to YES), I can handle the event in the GKTurnBasedMatchmakerViewControllerDelegate method turnBasedMatchmakerViewController:didFindMatch:.
However, I want to handle tapping on the various controls to view a match within the iOS system Game Center app.
For example, if I navigate to the Game Center iOS pre-installed app (not my app), tap on the Turns tab, tap on the row for my app, tap on a match/turn, and then tap on "View Game" or "Accept Invite" or "Play your turn", I want to handle these match-specific actions in my app.
When these items are tapped, my app indeed launches, but as far as I can tell from reading the documentation, there is no way to get extra information about which match the user tapped, so I can appropriately show that match.
Apple has chosen to remove this feature.
Their documentation is inaccurate. I opened a bug with Apple to investigate further. Here is the disheartening proof.
So with this new fingerprint thing you only need to tap the home button and hold your finger for a few moments to unlock your phone. I was wondering if there's an API that lets us make use of the "Tap" functionality.
i.e. Let's say in my app, when the user taps the home button, my app does xyz.
Also, would it be possible for my app to read these taps when the screen is locked?
NOTE: By tap I do not mean pressing the button, just a tap, like when we unlock the iPhone 5s with the fingerprint scan.
I'm completely new to iOS development. So referencing libraries with links etc and basic tutorials might make things a bit clearer for me.
Thanks.
Nope. This API does not exist. File a feature request at http://bugreport.apple.com. I can't imagine that this will get implemented though, given the possibility of abuse.
No there is no public API for the Touch ID sensor... yet. And there may never be one.