2012-02-08 67 views

回答

2
textView.userInteractionEnabled = NO; 

好的,如果你需要保留滾動,然後創建一個scrollView,將其設置爲出口,並添加textview。

然後在viewWillAppear中設置的TextView的高度:

- (void)viewWillAppear:(BOOL)animated { 
    [super viewWillAppear:animated]; 
    self.descriptionTextView.text = @""; // set some text to determine the total height 
    self.descriptionTextView.frame = CGRectMake(self.descriptionTextView.frame.origin.x, 
               self.descriptionTextView.frame.origin.y, 
               self.descriptionTextView.frame.size.width, 
               self.descriptionTextView.contentSize.height); 
    self.descriptionTextView.userInteractionEnabled = NO; 
    //next set new content size for scroll view 
    self.descriptionScrollView.contentSize = CGSizeMake(self.descriptionScrollView.frame.size.width, 
                 self.descriptionTextView.frame.origin.y + self.descriptionTextView.frame.size.height); 
} 
+0

不也防止滾動?雖然這個問題沒有說明_much_文本是如何存在的...... – jrturton 2012-02-08 12:18:09

相關問題