问题
I'm having trouble with a UITextView. I have seen other people have had this issue before, but whenever my app loads on my phone, all the UITextViews start from the bottom of their text and I have to scroll up.
I have tried numerous solutions but I need a solution to use on ONLY the Storyboard as I have some views without designated classes.
EDIT
I think this is happening when scrolling is enabled - so how do I have scrolling enabled but stop this from happening?
回答1:
Can not reproduce your issue on iOS 9.2,but you may try this
Set contentOffset
with Runtime Attribtues
回答2:
I face same problem and I still cannot find a solution using Storyboard
only.
However, using the code below can prevent your TextView
auto start at bottom
If your TextView
is in UIViewController
- (void)viewWillAppear:(BOOL)animated {
[self.myTextView setContentOffset:CGPointZero];
}
If your TextView
is in UIView
- (void)layoutSubviews{
[self.myTextView setContentOffset:CGPointZero];
}
Hope this help
回答3:
Have you tried something like:
[self.textView scrollRangeToVisible:NSMakeRange(0, 0)];
来源:https://stackoverflow.com/questions/34452005/uitextview-starting-from-bottom