[英]Showing TextView and Typing Text in TextView if i click any places in ImageView
[英]Text shifted up in the textView while i focus on Textview second time
我使用Textview插入消息文本,但是當我在插入一些文本后第二次專注於textview時,已經插入的文本發生了上移。 所以在TextView中剪切文本。 這個問題有解決方案嗎?
UITextView是UIScrollView的子類。 因此,您可以像這樣丟棄滾動到頂部:
((UIScrollView*)someTextView).delegate = self; // or some other UIScrollViewDelegate
並實現此方法:
-(void) scrollViewDidScroll:(UIScrollView*) scrollView {
scrollView.contentOffset = CGPointMake(0, 0);
}
但是,如果在編輯過程中確實需要滾動,則可以添加一些布爾標志來區分用戶滾動和自動滾動時的情況。
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.