UITextView scrollEnabled = YES not working after set scrollEnabled = NO in iOS8

后端 未结 8 890
失恋的感觉
失恋的感觉 2021-02-07 02:49

I create a demo for checking UITextView scrollEnabled. It only contains 1 UITextView and 2 button enable and disable scroll

  • I test on

8条回答
  •  执念已碎
    2021-02-07 03:25

    The problem is that in iOS 8, contentSize is not adjusted correctly when scrollEnabled is changed. A small adjustment to your enableScrollButtonPressed method will successfully work around the problem.

    -(IBAction)enableScrollButtonPressed:(id)sender
    {
        self.myTextView.scrollEnabled = YES;
        self.myTextView.contentSize = [self.myTextView sizeThatFits:self.myTextView.frame.size];
    }
    

提交回复
热议问题