2009-09-17 19 views

risposta

22

Dovrete fare questo a livello di codice, non credo che questo è possibile in Interface Builder.

Basta fare una cosa del genere

UITextView *myTextView = [[UITextView alloc] init]; 
myTextView.text = @"some text"; 
//some other setup like setting the font for the UITextView... 
[self addSubview:myTextView]; 
[myTextView sizeToFit]; 

nel metodo appropriato di visualizzare (ad esempio - (void)touchesBegan:(NSSet *)touches withEvent:(UIEvent *)event) o il controller della vista.

9
UITextView*txtview = 
    [[UITextView alloc]initWithFrame:CGRectMake(x,y,width,hight)]; 
[txtview setDelegate:self];  
[txtview setReturnKeyType:UIReturnKeyDone];  
[txtview setTag:1];  
[txtview setCornerRadius:5];  
[self.scrollview txtview]; 
1

In Swift

let textView = UITextView(frame: CGRectMake(x,y,width,height)) 
textView.textAlignment = NSTextAlignment.Center 
textView.textColor = UIColor.blueColor() 
textView.backgroundColor = UIColor.redColor() 
self.view.addSubview(textView) 
Problemi correlati