how to create a pointy UIView - iphone

I just saw local mind's app and they have a horizontal UIScrollView that has a selection with a pointy tip. How can I create such thing? I saw this often times in many apps where you don't just have a square frame, but you have a pointy edge to it, is this just a UIImage overlayed on top?
Other example would be this

If you disable clipsToBounds in the horizontal UIView (which is default), its subviews are allowed to stick out and draw past the edge of the frame.
Thus, yes, a UIImageView was probably how it was accomplished.

This is most likely achieved using an image. As simple as that.

Related

Mask an UITextView / UIView

Is it generally possible with an UITextView to have a mask which I can animate at runtime? Imagine a flash light effect: You have a circle mask and then move this circle around -- and only whatever is in the circle is shown of the UITextView.
Sorry to be so general, but I was only wondering if this is generally possible with an UITextView and where I would need to start to achieve such an effect. I found this: Mask UIView and this Mask text inside UITextView but neither is really about animating a mask at runtime.
Thanks!
Yes this is completely possible and easy.
It is very likely you *do not need the difficult concept of masks, as explained in the links you mention.
All you have to do is make another UIView (just do it in IB), and then move that new UIView around as you see fit.
It's just that easy. Hope it helps.

Stretchable UIImage and CGAffineTransform

I've got a UIScrollView whose zoom behavior I want to confine to the horizontal axis. I've accomplished that through using a custom UIView as the viewForZoomingInScrollView: and overriding setTransform:. So far so good – the view only zooms horizontally.
One catch: The container view includes some stretchable UIImage instances in UIImageViews. Obviously, with the transform in effect, the images distort.
What's the best bet for either redrawing the view so that the images aren't distorted, or, zooming the view in such a way as to not require transforms in the first place?
Thanks for any help you can offer.
You sure way of achieving this is to make your UIImageView into a custom UIView, and have its drawRect: code do the right thing: draw both stretched and unstretched elements.

How to auto rotate your own custom views?

I've learned that the best way to get graceful rotation is to set the auto rotation mask on the view that you want resize or move. This works fine if you're using SDK views like UILabel, but if you have your own custom view that uses the drawRect method it doesn't rotate as gracefully. In fact the only thing that happens is that it stretches whatever you drew in drawRect.
I've tried redrawing both before and after the rotation, but it doesn't give me that smooth rotation.
I looked at a UITextField auto rotating (flexible width) in slow motion and it follows the edge perfectly during the rotation. That is what I want my view to do, so how do I do that? My views jump to the right position either before or after the rotation.
The following line will make your UIView stretch the middle pixel only. If this is not your desired behavior I suggest you read the documentation for contentStretch to learn how to manipulate the values of the CGRect.
[self setContentStretch:CGRectMake(0.5, 0.5, 0.0, 0.0)];
I would guess that the UITextField you're looking at has at least three subviews, one displaying the left cap of the field's border, one displaying the right cap, and one displaying the middle, with autoresizing masks of "flexible right margin", "flexible left margin", and "flexible width", respectively. If you set up your custom view something like that, and make sure its autoresizesSubviews property is set to YES, then you should get the same smooth resize that the text field does.

Animating UIImageView over a background image

I have a UIImageView that I have resized to fit a small ball. The current background is black color. I want to set the background as some image and then move the ball on top of that image. I tried to use another UIImageView but the background takes over the ball image and the ball is not visible. Any ideas!
In IB, are you sure you have the small UIImageView in on top of the larger one? Try deleting the smaller UIImageView from IB and re-adding it on top of the larger one. I noticed that it's hard to tell which UIView is on top in IB for some reason.
Posting as requested. Glad I could help!
I would suggest not using interface build and just doing it programatically, much more control that way.

iPhone animation with stretchable image

I got a UIView subclass that draws a UIImage as its background. The image is created using the stretchableImageWithLeftCapWidth:topCapHeight: method, it has round edges.
I also use an animation block inside of which I resize my view. I had hoped that during animation, the drawRect:method would get called sometimes, which would result in the background image getting drawn correctly.
Unfortunately, the animation seems to render the image and then just rescale it during the animation, which obviously makes the formerly round edges getting nastily stretched.
The only workaround I can imagine is put three separate UIImageViews (top cap, middle fill, bottom cap) above my original background image and then reposition the caps images and scaling the fill image. However, this seems quite complicated...
Is there any better way I can prevent this from happening?
EDIT: Found this. Sounds bad...
While digging through some Apple docs, I coincidentally found the solution to my problem. All you have to do is play with UIView's contentStretch parameter. It allows you to manually specify the area of your view that gets stretched during animation.