我想周圍添加邊框的UITextView使用邊框沒有顯示出來
self.textView.layer.borderWidth = 1;
self.textView.layer.borderColor = [[UIColor brownColor] CGColor];
,但它沒有顯示出來。如果任何人都可以幫助我,爲什麼它不顯示。儘管我已經添加了Quartz框架。但仍然沒有出現。
#import "uitextviewViewController.h"
#import <QuartzCore/QuartzCore.h>
@implementation uitextviewViewController
@synthesize textView;
@synthesize navBar;
- (void)dealloc {
[navBar release];
[textView release];
[super dealloc];
}
- (void) viewDidLoad
{
[super viewDidLoad];
UIBarButtonItem * button = [[UIBarButtonItem alloc] initWithBarButtonSystemItem:UIBarButtonSystemItemDone
target:self
action:@selector(done:)];
[[self navigationItem] setRightBarButtonItem:button];
[button release];
self.textView = [[[UITextView alloc] initWithFrame:self.view.frame] autorelease];
self.textView.textColor = [UIColor whiteColor];
self.textView.font = [UIFont fontWithName:@"Arial" size:15];
self.textView.delegate = self;
self.textView.backgroundColor = [UIColor brownColor];
self.textView.layer.borderWidth = 1;
self.textView.layer.borderColor = [[UIColor brownColor] CGColor];
self.textView.textAlignment = UITextAlignmentCenter;
self.textView.text = @"This is UITextView\n\nThis is UITextView\n\nThis is UITextView\n\nThis is UITextView\n\nThis is UITextView.";
self.textView.scrollEnabled = YES;
[self.view addSubview: self.textView];
}
我將不勝感激。
在此先感謝。
可能重複[如何風格的UITextView喜歡圓角的矩形文本字段?](http://stackoverflow.com/questions/1824463/how-to-style-uitextview-to-like-rounded-rect-text-field) – Steve 2012-01-10 20:31:14