如何爲UITextView設置圓角?如何設置UITextView的圓角?
8
A
回答
20
拳頭導入文件
#import <QuartzCore/QuartzCore.h>
,然後設置文本視圖
yourTextViewName.layer.cornerRadius = kCornerRadius;
的財產,其中kCornerRadius
是你設置爲拐角
5
試試這個是一個常數將肯定工作
你必須導入
QuartzCore/QuartzCore.h
UITextView* txtView = [[UITextView alloc] initWithFrame:CGRectMake(50, 50, 300, 100)];
txtView.layer.cornerRadius = 5.0;
txtView.clipsToBounds = YES;
1
我在.H定義一個類別類的UITextView:
@interface UITextView (RoundedCorner)
-(void) roundedCornerDefault;
-(void) roundedCornerWithRadius:(CGFloat) radius
borderColor:(CGColorRef) color
borderWidth:(CGFloat) width;
@end
和實現類:
#import <QuartzCore/QuartzCore.h>
#import "UITextView+RoundedCorner.h"
@implementation UITextView (RoundedCorner)
-(void) roundedCornerDefault {
[self roundedCornerWithRadius:10
borderColor:[[UIColor grayColor] CGColor]
borderWidth:1];
}
-(void) roundedCornerWithRadius:(CGFloat) radius
borderColor:(CGColorRef) color
borderWidth:(CGFloat) width {
self.layer.cornerRadius = radius;
self.layer.borderColor = color;
self.layer.borderWidth = width;
self.clipsToBounds = YES;
}
@end
實施例使用它:
#import "UITextView+RoundedCorner.h"
...
[self.myTextView roundedCornerDefault];
+0
這個問題被張貼很長一段時間回來.. :) – 2012-04-27 05:59:01
相關問題
- 1. 帶有圓角的UITextView
- 2. 如何設置圓角適合模式的圓角UIImageView
- 3. Xaml TextBlock設置圓角
- 4. 如何設置圖像視角的圓角半徑
- 5. 設置的UITextView
- 6. 設置svg的圓角:圖像
- 7. Android:如何在圓角上放置圓角com.facebook.widget.ProfilePictureView
- 8. 如何設置在Silverlight的圓潤內網格的邊角4
- 9. 如何在iframe上圓角圓角
- 10. 如何使用xml設置顏色drawable的圓角半徑?
- 11. 如何爲帶有圓角的JDialog設置3D邊框?
- 12. 如何設置UItextview邊框的陰影?
- 13. 如何設置UITextView的右邊距?
- 14. 如何設置UITextView的限制大小?
- 15. 如何設置UITextView的字體大小?
- 16. iphone:按鈕圓角半徑未設置
- 17. 爲繪製UIImageView設置圓角半徑
- 18. 設置自定義圓角scrollbarThrtVertical scrollbarTrackVertical android
- 19. Android ProgressBar設置進度圓角
- 20. 圓角圓角?
- 21. 如何正確設置MX List的角點半徑並獲得圓角?
- 22. 如何製作帶邊框的半圓角(頂角圓角)texview?
- 23. android - 如何以編程方式設置圓角半徑?
- 24. 如何在drawRect中設置圓角半徑
- 25. 如何在joomla中設置圓角菜單
- 26. 如何爲黑莓設置圓角邊框BitmapField
- 27. 如何在Xamarin.Forms中爲段控件設置圓角
- 28. swift - 如何正確設置UITextView
- 29. 如何在UITextView中設置UIView
- 30. 如何在uitextview中設置html文件?
感謝好友,....工作.. :) – 2010-10-13 12:13:34
感謝它有幫助 – 2011-03-08 10:20:05
我已經有一個錯誤「使用未聲明的標識符kCornerRadius」 – 2016-10-28 09:57:33