2015-04-03 57 views
1

以前問過的問題完全一樣,但我想要某人將答案的代碼轉換爲Swift,因爲它在objective-c中。我也想在故事板上做大部分,可以SO用戶請幫助我嗎? UITextView in UIScrollView with paging not scrollingUITextView分頁不滾動

如果你懶得看的聯繫,就像我們都是:

CGRect labelFrame; 
UITextView *textView; 

labelFrame.size.width = scrollView.frame.size.width-24; 
labelFrame.size.height = scrollView.frame.size.height-48; 
labelFrame.origin.x = 10; 
labelFrame.origin.y = 40; 

textView = [[UITextView alloc] initWithFrame:labelFrame]; 
textView.textColor = [UIColor blackColor]; 
textView.backgroundColor = [UIColor redColor]; 
textView.font = [UIFont systemFontOfSize:13]; 
textView.text = @"a very long text"; 

textView.editable = NO; 
textView.scrollEnabled = YES; 
textView.userInteractionEnabled = YES; 
textView.delegate = self; 
textView.contentSize = CGSizeMake(1, 1000); //this would make it scroll? 
[subview addSubview:textView]; 

而且,這個問題的答案,我不完全理解他在說什麼。

回答

0

我不確定我是否完全理解了您的問題,但是如果要從故事板中啓用UITexView中的滾動,請從對象庫中拖放UITextView,並在屬性檢查器中爲UITextField選擇「滾動已啓用」屬性。 Select 'Scrolling Enabled'

+0

我說分頁具體而言,不滾動,還是謝謝你! – wogwog 2015-04-05 00:27:44

0

刪除 textView.scrollEnabled = YES; textView.userInteractionEnabled = YES; 並粘貼

textView.isSelectable = false 
textView.isEditable = false