Is there an ActivityIndicator (or something like it) in WatchKit for Apple Watch? How do you all give the user feedback about some longer lasting background activity?
相关问题
- How to put ActivityIndicator inside UIImage inside
- WCSession Failing to Activate
- Detecting swipes on all four directions on WatchKi
- NVActivityIndicatorView only for particular view
- Wat is the difference between static notification
相关文章
- How can I set the backgroundColor of a WKInterface
- How to avoid this error: “Took too long to show cu
- how to indicate to main UI thread when background
- Change text color of WKInterfaceLabel using NSMuta
- Is it possible to trigger a haptic feedback withou
- Apple Watch Table - first 4 rows not appearing
- WatchOS Unit Testing
- NSXMLParserErrorMessage - Could not open data stre
In my opinion, trying to create your own Spinner is using excessive resources. If Apple thought it was a good idea, they would have suggested it.
I would instead just have an Image that you adjust the Alpha. Use a boolean to see if you should be adding or subtracting Alpha.
}
Just to add to the options, I've created a
JBWatchActivityIndicator
project on GitHub that lets you generate your own image sequences: https://github.com/mikeswanson/JBWatchActivityIndicatorIt also includes Apple-like activity indicator animations if you don't want to create your own.
I built a simple activity indicator for the Apple Watch, available here https://github.com/tijoinc/WatchActivityIndicator
There is no method for displaying ActivityIndicator in WatchKit Framework. However you can prepare some circular image and easily create infinite animation yourself. Prepare images and name them like this
frame-0, frame-1, frame-2...frame-n
and then in your code:
Hope this helps.
Edit: This answer was originally posted prior to the introduction of Apple Watch models with cellular and wifi connectivity, and thus may no longer apply on newer models of the device (considering significant performance improvements).
This thread on the Apple Developer forums has an authoritative answer from an Apple engineer about why you shouldn't be performing network operations with Apple Watch.
There are two big reasons not to perform networking operations from your watch app / extension:
Users are interacting with their watches for only a brief period of time. See the Human Interface guidelines on this one.
The system may deadlock if the network request does not complete.
That being said. If you really need a UIActivityIndicator, rdar://19363748 (I don't think this one has been open radar-ed yet), developers have already filed requests for official support.
You can create a series of images in the activity indicator style of your choice and then animate them using the
startAnimatingWithImagesInRange:duration:repeatCount:
API. See Apple's Lister app for an example of wkinterfaceimage animation.Alternatively, look here for a WatchKit Animation tutorial and included "spinner" graphics.