0
我在設置內容大小後沒有顯示垂直滾動指示器時出現問題。UIScrollView垂直滾動指示器
看到這樣的代碼:
UITextView *textView = [[UITextView alloc] init];
[textView setAttributedText:attributeString];
[textView setFrame:CGRectMake(10, 0, self.view.frame.size.width -20, 100)];
[textView sizeToFit];
[textView setFrame:CGRectMake(10, 10, self.view.frame.size.width -20,
textView.frame.size.height +15)];
[self.scrollView addSubview:textView];
[self.scrollView setContentSize:CGSizeMake(self.scrollView.frame.size.width,
textView.frame.size.height +20)];
[self.scrollView scrollRectToVisible:CGRectMake(0, 0,
self.scrollView.bounds.size.width,
self.scrollView.bounds.size.height)
animated:YES];
[self.scrollView setScrollEnabled:YES];
[self.scrollView setShowsVerticalScrollIndicator:YES];
任何幫助,請
滾動型身高=視圖HEIGH –
的NSLog(@ 「%F」,self.scrollView.frame.size.height)= 628.000000在iPhone 6加 –
NSLog(@「%f」,self.scrollView.contentSize.height); = 1820.333333 –