久久久久久久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 中縮放和捏合)
主站蜘蛛池模板: 日韩一级二级片 | 久久久婷 | av一级久久 | 久草网址| 538在线精品 | 久精品久久 | 黄网站免费观看 | 日韩在线国产 | 福利视频一区二区 | 91综合网| 国产精品久久久久久妇女 | 成人h片在线观看 | 羞羞网站在线观看 | 国产精品乱码一二三区的特点 | 在线播放中文字幕 | 视频一区在线观看 | 国产三级网站 | 99热首页| 久久久久国色av免费观看性色 | 免费在线观看毛片 | 日韩高清一区二区 | 男女激情网 | 久久久久国产精品 | 五月婷六月丁香 | 成人av在线播放 | 欧美区日韩区 | 午夜av一区二区 | 午夜私人影院在线观看 | 国产视频久久久久 | 欧美在线一区二区三区 | 中文字幕第三页 | 国产欧美一区二区久久性色99 | 国产精品大全 | 国产欧美一级二级三级在线视频 | 国产a爽一区二区久久久 | 精品国产99 | 91精品国产91久久久久青草 | 亚洲一区国产精品 | 久久久久中文字幕 | 999久久久久久久 | 国产91九色 |