【问题标题】:How can I calculate the contentsize of UItextView in which the text are dynamically added………如何计算动态添加文本的 UItextView 的 contentsize…………
【发布时间】:2011-10-12 11:36:20
【问题描述】:

我有一个 UIScrollview,我在其中放置了 UIImageView 和 UITextView..这里我将数据动态添加到 UITextView...我想同时滚动图像和文本。它工作正常..我已经将 UITextView 的 contentsize 分配给 UIScrollView 的 contentsize .....因为我动态添加数据我不能使用标准值..任何示例来查找 UITextView 的 contentsize????

【问题讨论】:

标签: iphone uiscrollview uitextview


【解决方案1】:

UITextViewUIScrollView 的子类。所以可以直接使用contentSize方法,

CGSize _contentSize = textView.contentSize;
float _height = _contentSize.height;

【讨论】:

  • 如何将 CGSize 分配给内容大小(内容高度为浮点数)。
  • 您可以从 contentSize 中获取 height。查看我编辑的答案!
猜你喜欢
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
相关资源
最近更新 更多