久久久久久久av_日韩在线中文_看一级毛片视频_日本精品二区_成人深夜福利视频_武道仙尊动漫在线观看

文本量大時UITextView文本被截斷

UITextView text cut off when there is a large amount of text(文本量大時UITextView文本被截斷)
本文介紹了文本量大時UITextView文本被截斷的處理方法,對大家解決問題具有一定的參考價值,需要的朋友們下面隨著小編來一起學習吧!

問題描述

我有一個 UITableViewCell 子類,其中包含一個 UITextView 滾動已關閉.我在表格視圖單元格 layoutSubviews 方法中這樣設置它的框架:

I have a UITableViewCell subclass that contains a UITextView where scrolling is turned off. I set its frame like this, in my table view cell layoutSubviews method:

    CGRect frame = self.bodyTextView.frame;
    CGSize size = self.bodyTextView.contentSize;
    frame.size = size;
    self.bodyTextView.frame = frame;

這已經有一段時間了,但我注意到在我有特別大量的文本的情況下,文本會被截斷.我已將文本視圖框架背景顏色設置為橙色,以便驗證框架設置是否正確.這是一個示例(我只顯示文本視圖的底部):

This has been working fine for some time, but I've noticed that in a case where I have a particularly large amount of text, the text is getting cut off. I've set the text view frame background color to orange so I could verify that the frame was being set correctly. Here is an example (I am only showing the bottom portion of the text view):

框架是基于文本的正確大小(在本例中為 1019 磅),但文本在文本視圖底部之前停止.我還看到文本在一行中被截斷(即最后一個可見文本行的文本被水平截斷一半).有誰知道這里發生了什么?

The frame is the correct size based on the text (in this case 1019 points), but the text stops before the bottom of the text view. I have also seen the text get cut off part way through a line, (ie the text of the last visible line of text is cut off half way through horizontally). Does anyone have an idea what is happening here?

其他幾點:

  • 文本視圖適用于我所有內容較短的表格視圖單元格.
  • 如果我在上面顯示的情況下增加文本量,文本視圖高度會增加,但文本仍然會在同一位置被截斷.

推薦答案

根據this 和類似的答案,問題可能是正確的 contentSize 僅在 UITextView 添加到視圖后可用......在此之前它等于 frame.size"

According to this and similar answers, the problem could be that "the correct contentSize is only available after the UITextView has been added to the view ... Prior to that it is equal to frame.size"

我建議您以不同的方式計算高度,例如 -sizeWithFont: 或 -sizeTofit

I'd suggest you to calculate the height in a different way, like -sizeWithFont: or -sizeTofit

這篇關于文本量大時UITextView文本被截斷的文章就介紹到這了,希望我們推薦的答案對大家有所幫助,也希望大家多多支持html5模板網!

【網站聲明】本站部分內容來源于互聯網,旨在幫助大家更快的解決問題,如果有圖片或者內容侵犯了您的權益,請聯系我們刪除處理,感謝您的支持!

相關文檔推薦

Stop a UITableView from automatically scrolling(阻止 UITableView 自動滾動)
iOS UIScrollView Lazy Loading(iOS UIScrollView 延遲加載)
using iOS 6.0 SDK and building for iOS 5 Target causes UIScrollView setMinimumZoomScale to fail when running on iOS 5 simulator(在 iOS 5 模擬器上運行時,使用 iOS 6.0 SDK 并為 iOS 5 Target 構建會導致 UIScrollView setMinimumZ
Create partial-screen UIPageViewController programmatically(以編程方式創建部分屏幕 UIPageViewController)
how to make an ImageView zoomable with or without ScrollView.?(如何使用或不使用 ScrollView 使 ImageView 可縮放?)
UIImageView zoom and pinch in UIScrollView(UIImageView 在 UIScrollView 中縮放和捏合)
主站蜘蛛池模板: 日韩免费在线视频 | 91 中文字幕 | 91免费观看 | 美女在线观看av | 亚洲精品一| 免费国产视频 | 国产黄色av电影 | 久久精品超碰 | 亚洲资源站 | 青青99 | 久久中文字幕一区 | 狠狠艹| 亚洲欧美在线观看 | 我要看免费一级毛片 | 欧美激情国产日韩精品一区18 | 欧美视频精品 | 久久99网| 国产在线成人 | 国产精品一区一区 | 久久不射电影网 | 正在播放亚洲 | 色综合久久天天综合网 | 日韩免费一区 | 超碰成人免费 | 国产高清在线精品 | 玖玖视频国产 | 亚洲视频中文字幕 | 成人黄色电影免费 | 亚洲a视 | 精品国产乱码久久久久久88av | 理论片午午伦夜理片影院 | 国产一区二区三区免费 | 亚洲夜夜爽 | 日韩av成人 | 在线一区 | 在线a视频| 日韩精品一区二区三区中文在线 | 日本不卡高清视频 | a级片www | 国产精品亚洲一区二区三区在线 | 亚洲欧美中文日韩在线v日本 |