WKInterfaceSlider behavior like in Watch’s Now Playing - ios

How can I implement same border appearing behavior over a slider (or group) when user changes volume value by digital crown? I have insert a video which demonstrate this.

I have implemented this by using ValueAnimation from this question. Instead of using NSTimer I use GCD-based timer to have more flexibility. See RXTimer or DispatchTimer for more info.

Related

How to animate WidgetKit Widgets like other apps do it?

While Apple stated that animations should not be possible in Widgets, some apps managed to implement them. Example: https://apps.apple.com/app/id1588400483
These don’t only animate every second statically, but seemingly with 60/120 fps. How to achieve this?
I have been trying with the stock animation (which the documentation states don’t work) and by using timers. Both with no success at all.

Watchkit App: slider background color

I am surprised no one asked already this question, maybe I am just thinking something wrong. But here it is: I am trying to use WKInterfaceSlider to show some progress. The background of my app is black and I really need the background of the slider to match. It looks really bad with that dark grey default background. Isn't there really anyway to set it to replace it or simply set it to nothing?
I would accept also a no answer, but I would really like to understand why this choice in the APIs.
It seems you are unable to set the background color of the WKInterfaceSlider. You could always do a feature request.
I think the reason behind this is that the user should be familiar with the interface elements regardless of which app he/she uses.
Tips:
You could make your own Slider via a WKInterfacePicker. Where you define the slider as an image sequence. Highly customisable and you could slide it via the digital crown.
Check out this piece of code: Trying to get button to spin in WatchKit

How to animate NSAttributedString?

I need to animate the color and scale of an attributed string. CATextLayer does not work for me, because it can only change the foreground color for plain strings..
I found another solution, but I did not get it to work either Link
I need to get it to work on both Mac and iOS.
I think layers would be ideal, because I can do the scaling there easily..
Do you have any ideas?
If you need to animate a property that is not animatable, you can use CADisplayLink. That allows you to create your own animation by executing a method every time the screen refreshes. Although it looks sort of low-level, it is not really difficult to implement it.
You can find tutorials/examples on the web easily.
Note: It does not trigger your method periodically, therefore do not assume anything about timing and keep a counter and calculate progress your animation by yourself. Apart from that, CADisplayLink is cool.
Edit: As Max pointed out, CADisplayLink is not available for Mac. But there is CVDisplayLink, I guess you can achieve the desired animation by that. For more info on CVDisplayLink, you can have a look at that answer by Brad Larson.

How to make a slider volume controller on iOS? Objective-C, iOS 7 (or 8), xcode 5 (or 6)

I am learning to develop iphone apps and I have a simple question.
I am making a really simple app which allows the user to set the volume of the device on the settings screen using a slider instead of the volume buttons.
It may be quite obvious for experienced developers but I just can't find the answer I am looking for.
My question is:
How can I make this slider?
Basically I want to do this (image: https://www.dropbox.com/s/b81bzdwyrab0ha7/slider.png?dl=0):
I used to think that I could use a regular UISlider but some documentation says that I need to use something called a MPVolumeView. The problem is that I can´t find a good tutorial that tells how to use this explicity.
I found this link on the apple documentation but I dont understand how this works. – http://developer.apple.com/iphone/library/documentation/MediaPlayer/Reference/MPVolumeView_Class/Reference/Reference.html
And the description says: Use a volume view to present the user with a slider control for setting the system audio output volume, and a button for choosing the audio output route. When first displayed, the slider’s position reflects the current system audio output volume. As the user drags the slider, the changes update the volume. If the user presses the device volume buttons while sound is playing, the slider moves to reflect the new volume.
This is exactly what I want but I dont understand the example it gives. If you could please tell me how t make this slider work, even if it is on a new one-view project, I would really appreciate it.
Also I am aware that this method also creates an airPlay button next to the volume slider. Is there a way to delete this button? (My app is a simple productivity app so I only want the slider, not the airplay button).
I also understand that this will not work on the simulator. How am I supposed to know that this will work without having to test it on an actual device (I am not registered as a developer yet)?
Plus, I only know objective-c, not swift. If you could please restrain from using swift in your answers I would apreaciate.
Thank you so much for your help.
PD: English is not my first language. Sorry for any mistakes I made.
The MPVolumeView class is designed to let you do exactly this. It's in MediaPlayer.framework, so add that to your app to make things build correctly.
You create it and make it visible the way you instantiate any other subclass of UIView, which you probably know by now.
You disable the routing button by setting the "showsRoutingButton" property to false.
"How am I supposed to know that this will work without having to test it on an actual device?"
By seeing that it's been there since iOS 2.0, and is used in countless apps?
The process to writing such a slider is incredibly simple, look into UISlider(https://developer.apple.com/library/ios/documentation/UIKit/Reference/UISlider_Class/) and then use the float value from the slider to set the volume.
If you do not want to write your own slider, look on GitHub(github.com) for controls that do this for you. After doing a quick search, I found this UISlidersubclass that adjusts volume.

AlertView? Alert? What is it?

I've seen some cool looking "windows" / "alerts" /whatever they are called. I wish I knew. Here's some examples of them:
These shouldn't be Apple exclusive, since I've seen 3rd party apps use them! I'd like to know what are these windows?
It Custom UIActivityIndicator that you can found in this link
https://github.com/jdg/MBProgressHUD
MBProgressHUD is an iOS drop-in class that displays a translucent HUD with an indicator and/or labels while work is being done in a background thread. The HUD is meant as a replacement for the undocumented, private UIKit UIProgressHUD with some additional features.......
For mor information go to above Link
Thanks :)
These is not apple specific controls. You can create them.
The pop up shown in first image is very easy to make. You'll have to use 3 controls to make it.
Background UIImageView with the image.
UIActivityIndicatory
UILabel with whatever message you want to display.
You just have to load this UIImageView and Animate the UIActivityIndicatory to get this pop up. I've used these pop up in a lot of apps Apple don't object this.
Your first view is a UIProgressHUD. Original Apple HUD is in a private API and it is not recommended to use it.
http://cocoadev.com/wiki/UIProgressHUD
However, numerous implementations have appeared that emulate the original HUD. For one, have a look here:
https://github.com/y0n3l/LGViewHUD
though I am sure Google will give you a dozen similar implementations.

Resources