Designing a circular "selector" control - ios

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

Related

Drawing a "pointer triangle" in swift

I have a UIStackView consisting of clickable images. Whenever I tap one of them, a UIView appears on the right side of the stack, showing some more info about the clicked object. I'm trying to make a triangle, that will show user to what line in the stack does the UIView relate to, like shown in the picture:
I don't know how to do that though. My solution would be probably just make 10 UIImageViews (there's 10 lines in the stack) and whenever user taps an image,set it's corresponding UIImageView to a triangle and the rest to nil. That's clunky and dirty, though, is there any better solution? I'm sure there lots of ways to accomplish that, but what's the best one?

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 Add Image to TextField

I am experimenting a little bit witch apps programming.
How I can add a UIImage to a UITextField"?
Like Whats App or the most other Chat Apps.
I have search some time but doesn't find a solution, also i have tried to search in side of XCode with the auto complete but I have not found a function. So I hope you can help me.
The easiest way to add an image to a text field is to have a UIView that contains both UITextField and a UIImageView as subviews.
Next up, you can have a UIButton with both an image and text, and just set userInteractionEnabled to "NO" and it'll behave like a text view with an image next to it.
Now to get more complicated, if you want a chat-like text field that allows text (that you can type into) and images next to each other, you need to start thinking about custom subclasses. Other people have asked and have gotten answers for this same approach.

How to darken the reorder control in a UITableViewCell?

I have a pale green coloured tableview and when I enter Edit mode the reorder controls on the right edge are almost invisible. Can anyone tell me how to either use my own image for this or darken the system image?
I'm answering my own question because I don't want anyone else wasting time on this. You can't change this... I have resorted to switching my TableView's background colour back to white when I enter editing mode. This is yet one more horrible compromise but c'est la vie! Same with the right chevron in the accessoryView. It would seem obvious that one might be able to set this to the colour of their choice. Not so. The only way I found for doing this, simply darkening the chevron, was to subclass a UIControl and write my own drawRect method. Apple has an awful load of money yet cannot appear to employ enough programmers to keep a handle on this sort of very, very simple UI stuff. It appears that the bigger the libraries get the less we are able to actually do with them.

What is this iOS Contol and How To Implement it?

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.

Resources