How do I size a UITextView to its content on iOS 7?

I favor this minimal code change: Just add these two lines after addSubview and before grabbing the height of the frame … [scrollView1 addSubview: myTextView]; [myTextView sizeToFit]; //added [myTextView layoutIfNeeded]; //added CGRect frame = myTextView.frame; … This is tested backwards compatible with iOS 6. NOTE that it shrink-wraps the width. If you’re just interested in … Read more

CSS Div stretch 100% page height

Here is the solution I finally came up with when using a div as a container for a dynamic background. Remove the z-index for non-background uses. Remove left or right for a full height column. Remove top or bottom for a full width row. EDIT 1: CSS below has been edited because it did not … Read more

JavaScript – Get Browser Height

You’ll want something like this, taken from http://www.howtocreate.co.uk/tutorials/javascript/browserwindow function alertSize() { var myWidth = 0, myHeight = 0; if( typeof( window.innerWidth ) == ‘number’ ) { //Non-IE myWidth = window.innerWidth; myHeight = window.innerHeight; } else if( document.documentElement && ( document.documentElement.clientWidth || document.documentElement.clientHeight ) ) { //IE 6+ in ‘standards compliant mode’ myWidth = document.documentElement.clientWidth; myHeight … Read more