i want to display triangle shape UIView instead of using normal UIView.is it possible?
A UIView is always a rectangular shape, you can't alter that. However, you could perhaps get the effect you want by using CALayer masking. Make a UIView and apply a custom mask to it, whereby the mask has the appropriate data in it for a triangle. Then any actual content you put in your UIView will only be visible in the appropriate 'triangle' shaped area.
To make your mask layer, you can either use an image (e.g. a png) or use core graphics to draw a triangle.
There's tons of info on this sort of stuff in the Apple Quartz 2D docs.
There's an example here:
http://cocoadev.com/MaskingACALayer
See also this stack overflow question:
Learning Core Graphics
There's also info about this stuff in Apple's API docs for UIView and CALayer.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With