What is this iOS Contol and How To Implement it? - ios

I'm confused about:
1) What type of control is the one shown in the picture above. I tried slider, it's not giving that same visual effect
2) How can I implement such a control exactly as seen on the image.

It could be anything, but if i wanted to do it i would do it as a normal custom UIView, that has 3 UIButtons
This control will have a function like, setLevel:1,2,or 3
depending on the integer it will change the image of the UIButton accordingly

1) If you just want those 3 points(Low, High, Medium) you can do as #Omar suggested in his answer.
2) But if you want all intermediate points and the middle (blue) dot as a handle, you can use UISlider and change its minimumValue, maximumValue and thumb images.. See this tutorial

You can have two images one for selected and other for unselected and when any of the button is pressed change the image of button to selected image in button action and other two button will have unselected image.At a time only one button will be in selected state.

Now predefined iOS control have this presentation.
May be you can find in cocoacontrols.org or binpress.com to see if you can download a third controls made by developers.
Also, you can create yourself the control, on the two previous website, you can surely find a lot of control which mimic the display you want. You can download the source code, reverse engineering and build your own control
At worst, build this control from scratch with a UIView (maybe a UISlider) as super class.

Related

Customized UISlider with one more view

I need to create a subclass of UISlider in swift so that it has 3 bar views & 1 thumb image. Currently iOS Provides only 2 bar views & 1 thumb image.
The two bar views are minimumTrackImage & maximumTrackImage.
I need one more bar view on right hand side which is permissible limit of UISlider. i.e if slider has current value 50 max allowed value value is 100. I can able to set Permissible limit to 80 and slider will look like as below.
Could anyone please help...
Here is an example I quickly put together that hopefully shows what you need (see github-link below)....
Link to the example "permissibleLimitSlider" on GitHub
(The solution is done with Swift-3.1, Xcode-8.3.3 and iOS-Simulator-10.0)
The trick was:
A) to create a new maximumTrackImage (called "slider-track" in my example). I created that image in photoshop (but you can use a different graphics-program).
B) to add an IBAction (with Event "ValueChanged") from your Storyboard-Slider into the MyViewController. And in this method you simply observe the sender.value and limit it to 0.8
That's how it looks like in my github example:
Feel free to change colors by changing the Asses-images in the project!
Hope this static limit (of 0.8) is what you need. If you need a dynamic limit (settable in code), I suggest you provide something like 10 images, make the Slider a "discrete slider" and set your maximumTrackImage to one or the other image whenever you need to...
More examples on how to make your slider a discrete-slider can be found here
A very good tutorial on how to make custom-sliders can be found here

Swift - ios - creating ballon buttons

I want to create a set of buttons that will look like this:
(The selected buttons are those with a different background)
Any ideas for a simple implementation?
Are there any known open source implementations for this?
Thanks!
Following is the library which may be use to solve your problem,
For different appearance you need to give the conditional code for that but with out that your problem may solve with this library or code.
You can download the sample code of RRTagController project here.
For rounded corners use UIButton.layer.cornerRadius. if you set corner radius to half of the box you will get circle. For the border color use layer.borderColor = UIColor.redColor().CGColor.
For the background color of the button you can keep track with selected state of the button. Here is an example of using selected state: UIButton state selected
Next thing you could do is to keep data about selected ones, since the best way to do something like this would be UITableView - seems like every row of buttons have same height, and if you want to send that somewhere you can keep track about what items are selected.
I think the best way is to use UICollectionView.

ios draw shape under button

i want to achieve this functionality..!
On navigation change the bottom arrow should animate to left or right button selected.
i know only one way i can achieve this functionality by changing the complete background with bottom home selected to videos selected ..
so that i will have four complete background images with homeselected ,videos selected,etc
is their any better way to achieve this..
There are lots of custom views at Cocoa Controls
Here is search result
Here is some related
SDSegmentedControl
One more
RS3DSegmentedControl
Use them according to your need.

Designing a circular "selector" control

I'm developing an app that calculates poker odds, and now I'm facing some problems with the card selector.
This is a mockup of what I want.
I've found two ways to accomplish this. The first one is to use an entire UIImageView and detect touches, calculate where the touch has been generated, and set the corresponding value.
The second one is to use a lot of UIButtons, but in this case I get problems with the shape of the buttons.
Of course I can use a regular UIPickerView and so on but I think that the one I've designed is better.
if you have a UIButton with a background image that is shaped irregular. then that is the only point that the button can be pressed.
Change the type to custom and put your slices into buttons.
This has been my experience anyhow.
My buttons have to have a .01 alpha background to increase their pad size and people can push the button.
Hope that helps :)
After googled a little i've found https://github.com/ole/OBShapedButton .
it does anything what i need

How to make custom buttons in iOS?

The default iOS UI is nice but if I wanted to use images for buttons instead how would I do that - is it OpenGL?
Make the button a "custom button" type in interface builder. Then set the background image to be whatever you want the background to be.
Unfortunately the default button style is a little boring. You'll need to find or make a button with an image editor.
UIButton has a lot of support for custom buttons. In the nib (or storyboard or whatever), just click on the button and set its "Type" to "Custom" in the attribute inspector on the right side of the screen. Then, just below that, set the State Config to the sate you'd like (default, selected, etc) to customize, and set Image attribute to the image you'd like.
That image must be part of the project first before it will show up in the Image attribute (or in the app). You can add the image to the project simply by dragging it into the file navigator on the left side of the screen.
You can use images for buttons using a few simple lines of code:
// code to set image for button at normal state
[myButton setImage:[UIImage imageNamed:#"buttonImage.png"]
forState: UIControlStateNormal];
You can also use Xcode to change the type to "Custom" then you can set images for each button "state."
You can read more about UIButton states here
You can simply use PNG files that you create yourself. The UIButton class allows you to use custom images for all the different states of the application.
You don't really need to do custom rendering yourself, but if you really want, you can use UIKit to draw the images yourself in code (no OpenGL involved): http://developer.apple.com/library/ios/#documentation/2ddrawing/conceptual/drawingprintingios/graphicsdrawingoverview/graphicsdrawingoverview.html
You can do it by setting image or backgroundImage properties of a UIButton.
If you want your button to look nice when the size changes, you can use stretchableImageWithLeftCapWidth:topCapHeight: method of UIImage, with an appropriate image.
You may also want to use a custom component if it satisfies your need.
its very easy
change this two thing.Change "type" round rectangle to custom and drag image to project and select it as background .Run and Go
Well so far i was too looking for using custom buttons and the graphics, I've come through this site they have some awesome tutorial which was quite helpful for me. I've watched all the video tutorial and read some books but nothing helped me but this site and their 4 books are quite awesome and really helpful to read and understand it well.
http://www.raywenderlich.com/27191/learn-to-code-ios-apps-4-making-it-beautiful

Resources