2013-02-21 54 views

回答

1

您首先需要創建在你頭的出口。文件:

IBOutlet UITextView *textMultiLine1; 

然後,你需要將它連接在故事板:

enter image description here

則必須將它的框架:

textMultiline1.frame = CGRectMake(originX, originY, width, height); 

或者,如果你想改變只是它的高度:

float newHeight = 200.0; 

CGRect textViewFrame = textMultiline1.frame; 
textMultiline1.frame = CGRectMake(textViewFrame.origin.x, textViewFrame.origin.y, textViewFrame.size.width, newHeight); 

設置內容大小將僅更改內部TextView區域,導致更長(或更短,取決於您設置的值)滾動

+0

感謝您的快速回答。 – 2013-02-21 15:13:22

+0

當我使用你的例子時,我得到(CGRect)origin =(x = 0,y = 0)size =(width = 0,height = 0)。在我的頭文件中,我只能這樣寫:@property(weak,nonatomic)IBOutlet UITextView * textMultiLine1; – 2013-02-21 15:18:32

+0

您確定您已將插座連接到Interface Builder中的TextView嗎? – 2013-02-21 15:49:30

相關問題