Making a `UIView` line go half rounded on center of itself - ios

I'm struggling with a problem:
I did create an UIView with subviews inside to make my own UIToolBar.
I added a UIView which acts like a delimiter line on top of it.
Then I decided to make one of the subviews rounded on center. But I need to find a way to "curve" the delimiter UIView.
Actually I have:
I want:
Is there anyway to fullfill my goal programmaticaly in swift ?
I thought about importing an UIImageView and make the images according to the differents iPhone size but is there any other solution ?

I solved a similar problem by sandwiching a dark gray circle image behind the toolbar, and a light gray circle image in front of the toolbar but behind the button. It's a hack but it works perfectly if you match the colors, and it's easier than doing path drawing.

Related

How to make multiple masked UITextView on top of a UIImageView

NOTE: I can't use UIView's maskView method because that changes the UITextView into a single view. My UITextViews are movable via pan, rotate and pinch gestures and maskView doesn't allow that.
Please look at these 2 pictures to understand what I am trying to achieve:
The first picture is what I already have. The background image of the tiger is a UIImageView. On top, I have 2 UITextViews "Love" and "Yolo". There can be more than 2 UITextViews too. I am trying to convert the first to look like the second one. Basically I want the UITextViews to show transparent see-through text. Everything which is not UITextView gets grey color.
Now note the 3rd image where the 2 UITextViews overlap each other. When overlapping, I want it both the UITextViews to be see-through like this image:
How can I achieve this effect? I am looking for guidelines on how this can be achieved.

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.

iOS segmented control with a little triangle on top

How can I draw a little triangle above the selected item in a UISegmentedControl? Does anyone know an open-source than extends it?
(if not - pointers of how to do it)
Design should look like (this is in the bottom of the screen)
I don't believe there's a native way to do that. You can either find a library that allows for it, but you can do it yourself fairly easily, which I recommend.
I can think of a few out of the box ways to approach it, here at the two I think worth mentioning off the bat:
1) Use UISegmentedControl with images. Make the segmented controller have a height that includes the triangle, and have an image for selected and normal states that shows what you want. The Normal states would have a rectangle of transparency on top, as wide as the entire image and as tall as the triangle. The selected image would include the triangle. Both images should end up the same width and height.
2) Subclass UISegmentedControl and do some custom drawing in drawRect:. You could draw the triangle outside (above) the bounds of the segmented controller, make sure to set the segmented controller's clipToBounds property to NO, as well as its layer's masksToBounds property.
If you'd like more help, or some other suggestions, just ask.

Is there a way to set different frame sizes for different layers in a UIScrollView?

Right now I have a UIScrollView and a semi-transparent top and bottom bar which go over it. The UIScrollView contains a large UIImageView that is pannable and zoomable.
I want to be able to toggle the image and darken everything around a certain part of the image, but have the transparency mesh perfectly with the top/bottom bars which are semi-transparent. Since the content is scrollable/zoomable, if I darken the image itself, anytime that part goes under the top/bottom bars it will double darken.
I tried to solve this dilemma by creating a smaller UIScrollView that sits nested between the top and bottom bars, and sending zoom/pan commands to it in an attempt to mirror the UIScrollView below it, but that didn't work too nicely. It was a nightmare trying to sync the animations (I tried copying over the zoomScale/contentOffset in zoomDidScroll, sending the zoom/pan animation to each UIScrollView individually, using KVO, etc).
Is there any way I can set different frame sizes/cut-off points for each individual layer? Or perhaps each UIImageView subview? I'm open to any other proposed solutions as well, this has really been driving me up the wall. I appreciate the help.
What it's like before toggle:
What I want after toggle:
Why not cover the "center" part with another semi-transparent view to match the tool bars, then use a mask on the layer to make the part of it you wish fully transparent?

Advice on Twitter like UIView

I have a question on some UIView stuff. I want to create a Twitter-like UIView cf image. So, how to create this type of view? Is it composed of several UIViews like 1 for the topbar and a second for the content (white one).
If yes, how to create this shadow between these views?
How to create the white arrow on top left (just under the image).
Any code sample will be appreciated. Thanks all!
http://i.stack.imgur.com/MM8Qt.png
It's simple UIViewController with white background, containing UITableView with one cell.

Resources