How do I size a UITextView to its content? from stack overflow!
2012-07-17 23:59
656 查看
see:http://stackoverflow.com/questions/50467/how-do-i-size-a-uitextview-to-its-content
code:
CGRect frame = _textView.frame;
frame.size.height = _textView.contentSize.height;
_textView.frame = frame;
note this line:
One thing to note is that the correct contentSize is only available after the UITextView has been added to the view with addSubview. Prior to that it is equal to frame.size
@import url(http://www.cnblogs.com/Load.ashx?type=style&file=SyntaxHighlighter.css);@import url(/css/cuteeditor.css);
code:
CGRect frame = _textView.frame;
frame.size.height = _textView.contentSize.height;
_textView.frame = frame;
note this line:
One thing to note is that the correct contentSize is only available after the UITextView has been added to the view with addSubview. Prior to that it is equal to frame.size
@import url(http://www.cnblogs.com/Load.ashx?type=style&file=SyntaxHighlighter.css);@import url(/css/cuteeditor.css);
相关文章推荐
- Units Problem: How to read text size as custom attr from xml and set it to TextView in java code
- Units Problem: How to read text size as custom attr from xml and set it to TextView in java code
- How to Answer(From Stack OverFlow)
- Units Problem: How to read text size as custom attr from xml and set it to TextView in java code
- How to provide animation when calling another activity in Android?( from Stack overflow)
- How to create a StackOverflowException. And how to figure out where it is happening.
- How to bind a GridView to a list of multiple types? NHibernate proxy causing problems with databinding [From stack overflow]
- How to access Master page controls from the Content page
- How to transfer site content DB from C drive to Other drive
- How do i prevent end users from connecting to the database other than my application?", version 8.1.5
- Tip:How to Compact a PST File to Reduce Its Size in Outlook
- How to change the default stack size on different platforms
- [转]How to remove an assembly from the Cache if it is locked by Microsoft Installer
- How do I autosize a button to fit its text
- How to obtain access to an ActiveX control from its property page 如何从一个控件的属性页中获取对该控件的访问?
- How to get interesting data from Content Providers
- From an inner class, "this" points to the inner object. How do I get a "this" pointer to the enclosing object?
- How do I fix "selector not recognized" runtime exceptions when trying to use category methods from a static library?
- how to scroll a ScrollViewer at design time in Blend to manually design content for it that goes beyond the visible view
- How to Know When You’ve Made It(摘录自 work from passion)