2016-04-02 15 views
0

Ich habe ein Problem mit dem vertikalen Scroll-Indikator, der nicht angezeigt wird, nachdem ich die Inhaltsgröße eingestellt habe.UIScrollView Vertikaler Scroll-Indikator

sehen diesen Code:

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]; 

jede mögliche Hilfe bitte

Antwort

0

Ich weiß nicht, warum, aber ich versuche, dies und es funktioniert gut

[self.scrollView setScrollEnabled:YES]; 
[self.scrollView setShowsVerticalScrollIndicator:NO];  
[self.scrollView setShowsVerticalScrollIndicator:YES]; 
0

Zunächst einmal, was Ihre Scrollhöhe ist, wenn Scrollhöhe> sein Inhalt Größe zu scrollen dann ist Scroll nicht in der Lage.

+0

Scroll height = Ansicht heigh –

+0

NSLog (@ "% f", self.scrollView.frame.size.height) = 628,000000 auf dem iPhone 6 plus –

+0

NSLog (@ "% f", self.scrollView.contentSize.height); = 1820.333333 –