Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

UITextView with rounded corners

Tags:

iphone

in many iPhone apps I could see UITextView with rounded corners. Is there a simple way to achieve this? or do I need to create a custom UITextView? any links to examples showing how to achieve this?

Thanks!

like image 274
Jakub Avatar asked Aug 29 '10 19:08

Jakub


People also ask

What are curved corners called?

A squircle is a shape intermediate between a square and a circle. There are at least two definitions of "squircle" in use, the most common of which is based on the superellipse. The word "squircle" is a portmanteau of the words "square" and "circle". Squircles have been applied in design and optics.

How do you do rounded corners in paint?

In the upper left corner, select “Draw Filled Shape“. Draw the rounded rectangle over the area you would like to keep for your rounded corners image. Use the Magic Wand to select the area of the rounded rectangle. Select “Edit” > “Invert Selection“.

How do you make rounded corners in sketch?

You can choose between multiple corner styles (Smooth, Rounded, Angled, Inside Square and Inside Arc), changing how the layer's corners look. Head to the Corners section in the Inspector while editing any shape and pick the one you want from the dropdown menu.


2 Answers

If you are using iOS 3+, you can do the following:

myTextView.clipsToBounds = YES; myTextView.layer.cornerRadius = 10.0f; 
like image 141
bstahlhood Avatar answered Oct 10 '22 21:10

bstahlhood


Add QuartzCore framework to the app and then

#import <QuartzCore/QuartzCore.h>   UITextView* txtView = [[UITextView alloc] initWithFrame:CGRectMake(50, 50, 300, 100)]; txtView.layer.cornerRadius = 5.0; txtView.clipsToBounds = YES; 
like image 45
Suresh Varma Avatar answered Oct 10 '22 22:10

Suresh Varma