在许多 iPhone 应用程序中,我可以看到具有圆角的 UITextView。 有没有一种简单的方法来实现这个效果?还是我需要创建一个自定义的 UITextView?是否有示例链接展示如何实现这个效果?
谢谢!
在许多 iPhone 应用程序中,我可以看到具有圆角的 UITextView。 有没有一种简单的方法来实现这个效果?还是我需要创建一个自定义的 UITextView?是否有示例链接展示如何实现这个效果?
谢谢!
如果你正在使用iOS 3+,你可以执行以下操作:
myTextView.clipsToBounds = YES;
myTextView.layer.cornerRadius = 10.0f;
将QuartzCore框架添加到应用程序中,然后执行操作。
#import <QuartzCore/QuartzCore.h>
UITextView* txtView = [[UITextView alloc] initWithFrame:CGRectMake(50, 50, 300, 100)];
txtView.layer.cornerRadius = 5.0;
txtView.clipsToBounds = YES;
myTextView.layer.cornerRadius = 20
它还具有许多其他很酷的功能,例如带验证的文本字段、带边框的控件、虚线边框、圆形和发际线视图等。