how could I implement such effect of progress bar in iOS - ios

I have customized track image and progress image, the point is I don't want them to be with the same width. But it seems like when I use setTrackImage and setProgressImage, they always keep the same wide. Now my implementation turns out as the first image, but I want the effect just like the second image.

Yes, use UISlider and then remove the thumb image by simply adding an empty image.

Related

How to custom iOS UISlider with gradual change of track height and transparency

I want to create two custom UISlider look like below, the first will adjust track height, the second will adjust transparency, can anyone help?
It is possible to use custom images for the slider track and the handle. Have a look at his post for starters: iOS - custom image for UISlider

Minimimtrackimage alignment issues in swift

I’m trying to create a waveform player similar to soundcloud, the minimum track image I set for the slider originally kept stretching to the slider button itself. I wanted it perfectly aligned with the maximumtrackimage so I users the code:
Image.ResizableImage(withCapInsets:UIEdgeInsets:0,0,0,0)
Screen shot
Which made the image stretch out past the slider button to the whole slider track itself, which is what I wanted but the problem is that the image is passing the slider track and I want it to resize from the beginning of the slider track to the end.
I can't quite remember what the SoundCloud interface looks like, but I seem to recall it's something like this:
I generated that effect easily without using any slider. In general it's probably best to do things the easy way, constructing your own interface rather than trying to bend some existing interface element (such as your slider) to some purpose for which it was never intended.
My interface consists of two image views, a red version of the sound "wave" with a black version laid on top of it. The "transition" from black to red is performed by sliding a layer mask sideways over the black version of the image view, thus revealing the red version which was hidden behind it.
So all you would have to do is coordinate the position of the layer mask with the position being played within the song. If you wanted to use this as a scrubber, you would just detect the user's finger within the image view and do the same thing.

Custom UISlider with pips ios

Wondering if the above can be created using UISlider? If not, what other ways can this be accomplished?
You can set components of a UISlider, such as the currentThumbImage ( see: "Appearance of Sliders"1).
However, it is almost certainly easier to just re-implement a slider for this much customization. Simply use background UIImageView with the scale image, and then add a separate UIView (or UIImageView) for the arrow. Finally, attach a UIPanGestureRecognizer to the arrow view to allow a user translate the view vertically.
You can change a lot in the appearance of a UISlider like setting the thumb to a red arrow. You can also replace the background image with the inches ruler and with different rulers for the different device types and display sizes.
The one thing that I don't see is that you turn the slider to work vertically. I know them only working left to right.
If I'm right, your only chance is to have a ruler as background image and a view that contains the arrow and a label with the actual value. That whole view can be pawned and tapped using Gesture Listener.

How to create rounded images with WatchKit?

I'm trying to do a rounded images to be shown in my WatchKit application but I don't find any method to do it programatically.
What I have done to perform that, it is use my original image as a group background and put inside a mask image with rounded shape but I think this is not so clean.
Another different solution that I have thought is to create in my backend a new thumbnail or similar with the shape I want to show, but this require more time to be programed.
I could use also radius parameter from WKInterfaceGroup but, in my case (see the image below), I will lose my notification bubble that I have in a corner.
My app interface:
Uber application example:
Put your WKInterfaceImage inside a WKInterfaceGroup and round the corners of the group in Interface Builder.
What you are trying to create is not possible at the moment (we'll see if Apple will add new features to WatchKit this Summer). You'll need to mask your icons on your device and cache on your Watch.
As 'bgilham' said you could put the WKInterfaceImage inside WKInterfaceGroup, but you don't have to. You can just set the background image of WKInterfaceGroup. This time you can create some shiny fake subviews. WKInterfaceGroup inside WKInterfaceGroup with different background images on them.
For example. Lets say you have three ui (WKInterface) elements 'iconGroup', 'badgeGroup', 'badgeLabel'.
Center badgeLabel inside badgeGroup. Set badgeGroups radius to half of its height. If badgeGroups width is equal to its height you'll get a nice circle. Place your badgeGroup inside iconGroup at the top right corner. You can now set the radius of iconGroup equal to the radius of badgeGroup. Set the background image and you'll get a nice rounded rectangle with an dynamic badge.
You also can hide some items (groups) and fake some dynamic changes inside your watch app. There is tons you can create with such fakes. If you will add some animations (for example .png files) you can create fake views with transparent overlays and so on.
UPDATE:
I checked the uber screenshots of uber app, because I was wondering how they created that overlay over the map. My only clue is that they creating a lot of images on their iPhone and sending them to the apple watch to animate the background image of the WKInterfaceGroup. If the images are cached they will play 30fps on the watch otherwise its going to be 10fps or so.
My statement:
So rethink your design, its not always good to make a design like everyone else do. Create something shiny and new so people will memorize your work. :)
Hope this will help you guys out there to rethink your work and create some cool watch apps. Day one apps aren't that great at all, only a few of them are.
You can actually achieve this by using three groups:
The 1st WKInterfaceGroup has your original non-cropped image as its background.
The 2nd WKInterfaceGroup, which is inside the 1st one but has the same size, has the circle image mask as its background.
The 3rd WKInterfaceGroup, which is inside the 2nd one, contains your badge. You can put the text label in it.
Although this requires a pure simple background so the mask image can simply just overlay above the background image, this one doesn't require any image data transferring between the phone and the watch.
The only way to do this right now is just as you said. To mask the profile image into a circle, add it to a group, then add the notification bubble group as a sub-group of the main one (with a circular radius and the label inside.)
Right now there is no way to have a sub-group ignore its parent's clipping radius.
i have used UIImage category from http://vocaro.com/trevor/blog/2009/10/12/resize-a-uiimage-the-right-way/.
this has a Category for Rounded corner images, worked for me in watchkit app.

UIScrollView Blur Effect

A am using the brilliant StackBlur class with in my project which works fine however I am trying to create a similar effect to the Yahoo Weather App in which the image blurs according to the scroll value. I have managed to achieve it using the scrollViewDidScroll method however the effect is slow and laggy.
What is the best way yo resolve this? Storing the image to the Cache is the only thing I can think of.
Thanks
UPDATE
I simply created two UIImageViews one with the blur and then set the alpha to zero and increased it with the content offset off the scrollview.
You don't need to blur every time when scrollViewDidScroll called. Instead, you need a blurred imageView with the final blur effect and none blurred imageView placed below the blurred one. Change view.alpha of blurred imageView from 0.0 to 1.0 will get this effect without extra cost.
Try DKLiveBlur to show live effect of yahoo blur.

Resources